Home › Forums › Classic DFFS › Multiple Fields with If/then
- This topic has 2 replies, 2 voices, and was last updated 7 years, 5 months ago by Alexander Bautz.
Viewing 2 reply threads
-
AuthorPosts
-
-
April 20, 2017 at 16:31 #16398
Hi,
I am trying to use the CustomJS feature to evaluate several fields at once rather than writing multiple rules. I am doing a similar evaluation several times in my form.
First Eval:
Q1/Q2 – if either question is yes, display XTab – if both are No, display YTabSecond Eval:
On XTab (4 yes/no questions) – if ALL questions are yes, display ZTab, otherwise, display YTabI tried to take some code that you had written in another post and do the First Eval, but I keep receiving an error when I try to run it.
Thank you in advance!
function showXTab(){ var Q1 = getFieldValue("Q1"); var Q2 = getFieldValue("Q2"); if(Q1 === "Yes" || Q2 === "No"){ spjs.dffs.toggleVisibleTab("Xtab",true); if(Q1 === "No" || Q2 === "Yes"){ spjs.dffs.toggleVisibleTab("Xtab",true); if(Q1 === "Yes" && Q2 === "Yes"){ spjs.dffs.toggleVisibleTab("Xtab",true); }else{ spjs.dffs.toggleVisibleTab("Ytab",true); } } //Change event on drop down spjs.$("#dfss_Q1, #dffs_Q2").on("change",function(){ showXTab(); });
-
April 21, 2017 at 20:20 #16422
I got there – here’s the final code I ended up with:
function showSpreadsheet(){ var S1a = getFieldValue("S1a"); var S1b = getFieldValue("S1b"); if(S1a === "Yes" || S1b === "No"){ spjs.dffs.toggleVisibleTab("Spreadsheet",true); spjs.dffs.toggleVisibleTab("Model",false); spjs.dffs.toggleSelectedTab("Spreadsheet"); if(S1a === "No" || S1b === "Yes"){ spjs.dffs.toggleVisibleTab("Spreadsheet",true); spjs.dffs.toggleVisibleTab("Model",false); spjs.dffs.toggleSelectedTab("Spreadsheet"); if(S1a === "Yes" && S1b === "Yes"){ spjs.dffs.toggleVisibleTab("Spreadsheet",true); spjs.dffs.toggleVisibleTab("Model",false); spjs.dffs.toggleSelectedTab("Spreadsheet"); }else{ spjs.dffs.toggleVisibleTab("Spreadsheet",false); spjs.dffs.toggleVisibleTab("Model",true); spjs.dffs.toggleSelectedTab("Model"); } } } } // Change event on dropdown spjs.$("#dffs_S1a", "#dffs_S1b").on("click",function(){ showSpreadsheet(); });
-
April 27, 2017 at 20:42 #16441
I’m glad you figured it out. I have a hard time following up on all comments in time.
Best regards,
Alexander
-
-
AuthorPosts
Viewing 2 reply threads
- You must be logged in to reply to this topic.