Forum Discussion
KenCasser
8 years agoQrew Cadet
When I copied my code above, it missed the last line which gave the result. It should have ended with:
q=(yr+leadingZero(mo)+leadingZero(da)+leadingZero(a));
In the meantime, I've figured out how to access my javascript page with a URL button, and am doing an API_AddRecord using ajax (modified from the QB API Boot Camp). I've successfully generated new records and am able to pass literals using:
var request="<qdbapi>";
request += " <field fid='7'>Kenny</field>";
request += "<field fid='6'>q</field>";
request += "</qdbapi>";
Field 7 says "Kenny", and field 6 says "q". I want field 6 to have the result of the variable. I've tried:
request += "<field fid='6'>$q</field>";
and a bunch of other iterations, and I've searched and read and searched and read, but can't for the life of me figure out how to get the value of q into fid 6. (Yup, I tried value.q, value(q), etc)
I also tried adding:
$(bnfynvsjt, {
act: "API_EditRecord",
rid: kRid,
_fid_6:q
});
to it, but that didn't work either. Maybe I put it in the wrong place or maybe I can't do two API calls in the same script, but I can play with that some more tomorrow. But if you can save me some time I'd sure appreciate it!
Oh, and I know the calculation is working because after the 'request' info I do a console.log(q), and a correct result appears in the console when a new record is generated.
Any ideas? Thank you!
q=(yr+leadingZero(mo)+leadingZero(da)+leadingZero(a));
In the meantime, I've figured out how to access my javascript page with a URL button, and am doing an API_AddRecord using ajax (modified from the QB API Boot Camp). I've successfully generated new records and am able to pass literals using:
var request="<qdbapi>";
request += " <field fid='7'>Kenny</field>";
request += "<field fid='6'>q</field>";
request += "</qdbapi>";
Field 7 says "Kenny", and field 6 says "q". I want field 6 to have the result of the variable. I've tried:
request += "<field fid='6'>$q</field>";
and a bunch of other iterations, and I've searched and read and searched and read, but can't for the life of me figure out how to get the value of q into fid 6. (Yup, I tried value.q, value(q), etc)
I also tried adding:
$(bnfynvsjt, {
act: "API_EditRecord",
rid: kRid,
_fid_6:q
});
to it, but that didn't work either. Maybe I put it in the wrong place or maybe I can't do two API calls in the same script, but I can play with that some more tomorrow. But if you can save me some time I'd sure appreciate it!
Oh, and I know the calculation is working because after the 'request' info I do a console.log(q), and a correct result appears in the console when a new record is generated.
Any ideas? Thank you!