One of the main areas of confusion when using DFFS is the automatic rule reversing of rules that are NOT evaluated to true.
This example show how most users first set it up and ends up with the wrong result. I’ll first show how it is set up to make it fail, and then I’ll highlight the missing part at the bottom of this post.
The example form
Let’s say you have a choice field TabVisibility that controls the visibility of a specific tab. For this example I have created a choice field with two values: Show and Hide, an have set up three rules.
The tabs:
The rules:
One for hiding the tab when the TabVisibility choice field is empty:
One for showing the tab when the value is Show:
And one for when the value is Hide:
This is how it looks when loading NewForm and the value in TabVisibility = blank, but it is not doing what you expect:
Why this is not working
When you have trouble with a form you should always use the Debug this rule setting:
This will show you the debug panel below the form:
When the form loads, each of the three rules are evaluated. The first rule is evaluated as “true” and hides the tab as it should:
Then the next rule runs and is evaluated as “false” and does the opposite of what it is configured to do. It doesn’t do anything wrong here because the tab is already hidden, but you see where this is going:
Then the last rule comes in and messes it up by showing the tab despite it being set up to HIDE the tab and not to show it:
Why is this happening?
The reason for this behavior is to avoid writing two rules for every action and just let DFFS handle the reversing – for example if a Yes/No field is checked: show some fields, set some fields required etc. Then if the field is unchecked, all visible field are hidden, required fields are set as optional etc. This is by design to limit the number of rules required to make a dynamic form.
This will however create problems when you use multiple rules on for example a single choice column as described above.
How to fix it
In this scenario you must use the No reversing of this rule setting in each of the three rules (optionally you can check the Disable reversing of all rules in the top of the Rules tab):
When you have done this your NewForm will load correctly and hide the tab:
That’s it – post any comments below, or use the forum.
Alexander
The biggest issue for me is when you have multiple rules setup on the same field.
For instance, I have a people picker field. I have 3 rules. One for if User = John Doe, the 2nd for if User = Jane Doe, and the 3rd for if the people picker is blank.
I can’t figure out how ordering of rules impacts this. I’ve tried several different configurations, and I can’t get it to reliably work.
Each rule should display a different message below the people picker. I notice that even though the User = Jane Doe, the message I have for that rule won’t appear, and I guess it’s because the other rules related to that field are overwriting it.
So how would that get handled?
Also how does ranking of rules work, is a lower index more important, or is it a higher index?
So I was able to fix based on the info provided in this post by setting each of those options to not reverse if false. I’ve done that several times in the past, but still feel like I struggle with the logic.
It happens often when I’m trying to make the form foolproof, which is really my own problem for trying to always account for human error.
So like for example say I should have a tab that should only be visible when a status = specific value.
However, I also need that tab to remain visible if information in that tab has been filled out, and the status is changed to something else because the user may need to revert back to that information.
Otherwise, if the status does NOT equal that specific value, AND no information was provided in a specific field on that tab, then you can just hide the whole tab. Typically requires me to create 3 rules.
Rule 1: Show tab when status = specific value on load or change.
Rule 2: If specific field on that tab is blank on form load only, then hide the tab. (this field is required when the status is set to that field, so I know it has to have a value if it was ever truly set to this status. This should also only validate on load, because otherwise the rule would reverse on change once they filled that field out.)
Rule 3: (Linked Rules on change only) If Rule 1 is false AND Rule 2 is true, then hide the tab. This will reverse properly as needed, but only if I have the “Let linked rules trigger parent rule on change” option selected.
That’s another big thing, I’m really not 100% sure what the “Let linked rules trigger parent rule on change” option is and how it impacts the rules. Like what’s the difference between having it and not having it. Would really love a write up specifically on that attribute.
Thanks for all you do, Alex!
I’m glad you figured it out. I’ll try to do a write up on the Linked rules and Let linked rules trigger parent rule on change.
Alexander