Home › Forums › Classic DFFS › Handling multiple fields in rules
- This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by Alexander Bautz.
-
AuthorPosts
-
-
March 18, 2018 at 17:37 #20301
Hi,
I got a form with 4 Tabs. Initially only the first tab shall be visible and as soon as all required fields are not empty the others shall be visible.
I got it to work with one field but not that all fields must be filled. How to combine the rules so the tabs appear when all fields are filled?
thanks.
ChristophAttachments:
-
March 19, 2018 at 22:06 #20324
Hi,
This needs two rules and some custom js. First add two rules.First rule
Rule friendly name: showTabs
trigger: No trigger (must be triggered manually)
Visible tabs: list of tabsSecond rule
Rule friendly name: hideTabs
trigger: No trigger (must be triggered manually)
Hidden tabs: list of tabsThen add this to the Custom JS:
function showTabsWhenAllRequiredFieldsAreFilledIn(){ var arrOfFields = ["Field1","Field2","Field3"], allFilledIn = true; jQuery.each(arrOfFields,function(i,fin){ if(getFieldValue(fin).length === 0){ allFilledIn = false; } }); if(allFilledIn){ clearInterval(showTabsInterval); spjs.dffs.triggerRule(["showTabs"]); }else{ spjs.dffs.triggerRule(["hideTabs"]); } } var showTabsInterval = setInterval(function(){ showTabsWhenAllRequiredFieldsAreFilledIn(); },1000);
Change “arrOfFields” to match your fields.
This will check to see if all fields have been filled in every second, and when they are it will show your tabs.
Let me know how this works out.
Alexander
-
November 16, 2018 at 12:58 #22856
Hi,
since I updated DFFS with the latest version I got following error, with the above code.ERROR – You are trying to trigger the rule “showTabs”, but there is no rule with this id defined.
but it did work before. There was never a rule connected with this function.
thanks for any help.
this has been resolved.
- This reply was modified 6 years, 1 month ago by Christoph Moosbrugger.
-
November 16, 2018 at 13:55 #22859
sorry Alexander,
this has been resolved. I found the error already.
thanks.
-
November 16, 2018 at 16:40 #22867
I’m glad you figured it out.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.