Forum Discussion
AustinK
Qrew Commander
So is tdf_1 your field that you found through the method Everett described? The error your are getting is telling you the field you are trying to convert into a number is not a number(NaN).
I wouldn't normally use so many alerts but if you want to know what the field is just go to your form and type this into console.
alert($("#tdf_1").text())
And tell us what that says. I still feel like you just need to adjust the #tdf_1 part to be the correct number for your field you are wanting to check.
I wouldn't normally use so many alerts but if you want to know what the field is just go to your form and type this into console.
alert($("#tdf_1").text())
And tell us what that says. I still feel like you just need to adjust the #tdf_1 part to be the correct number for your field you are wanting to check.
BrandonClark
5 years agoQrew Cadet
You nailed it. I let the original parameter back in on a copy/paste. The tab selection is working now. And I now understand how to check the parts along the way. You guys are awesome.
(Side note: For anyone else that is struggling with Javascript, I found this little tutorial to be a pretty efficient way to learn the basics - https://www.learn-js.org/ )
Now for the last piece, I need to take a stab at setting the Tab # field back to 0 after the focus. Will post what I figure out. Here's the code page as it stands:
(function () {
------------------------------
Brandon Clark
------------------------------
(Side note: For anyone else that is struggling with Javascript, I found this little tutorial to be a pretty efficient way to learn the basics - https://www.learn-js.org/ )
Now for the last piece, I need to take a stab at setting the Tab # field back to 0 after the focus. Will post what I figure out. Here's the code page as it stands:
(function () {
//Get the expected tab value
var QBUmytab = Number($("#tdf_2").text());
//Go to tab based on value
switch(QBUmytab) {
case 2:
$("#tab_t2_link a").click();
break;
case 3:
$("#tab_t3_link a").click();
break;
case 11:
$("#tab_t11_link a").click();
break;
case 20:
$("#tab_t20_link a").click();
break;
case 30:
$("#tab_t30_link a").click();
break;
};})();
------------------------------
Brandon Clark
------------------------------
- DonLarson5 years agoQrew CommanderThanks for the JS link. It is becoming more and more important to dig into the browser. I will give it a long look over.
------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------ - EverettPatterso5 years agoQrew CaptainYou will need to add the API_EditRecord call to each case and it will set that field back to 0 after it does the focus.
Replace dbid with your dbid
(function () { //Get the expected tab value var QBUmytab = Number($("#tdf_2").text()); //Go to tab based on value switch(QBUmytab) { case 3: $("#tab_t3_link a").click(); var dbidParents = "VALUE"; var rid = kRid; $.post(dbidParents, { act: "API_EditRecord", rid: rid, _fid_104: 0, }).then(function(xml) { }); break; case 4: $("#tab_t4_link a").click(); break; };})();
------------------------------
Everett Patterson
------------------------------ - BrandonClark5 years agoQrew CadetIt works brilliantly. Everett you are genius. Thank you.
------------------------------
Brandon Clark
------------------------------ - BrandonClark5 years agoQrew CadetStarting to see the first minor flaw in the plan. The fid_104 is required to be visible on the form for this work. I can live with that for now but any thoughts on a better way to pass the information without using it on the form?
------------------------------
Brandon Clark
------------------------------