Hi, we have previously used the below code to include or exclude a form field.
[cred_show_group if="( $(location) eq 'Location1' )" mode="fade-slide"]
[cred_show_group if="( $(location) ne 'Location2' )" mode="fade-slide"]
What code do we use if we have 5 Locations and we want to show a field on 2 of them or hide field on 2 of them?
https://toolset.com/documentation/legacy-features/views-plugin/conditional-html-output-in-views/#comparison-operator
Hello,
You can use "OR" and "AND" logic Operators in your shortcodes, see our document:
https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/#logic-operators
section "Logic Operators"
For example:
[cred_show_group if="( ( $(location) eq 'Location1' ) OR ( $(location) eq 'Location2' ) )" mode="fade-slide"]
...
[/cred_show_group]
Thank you! That worked for the 'eq' but did not work for the 'ne'
[cred_show_group if="( ( $(location) ne 'Location1' ) OR ( $(location) ne 'Location2' ) )" mode="fade-slide"]
The conditions you mentioned above will output the result always.
According to the description you mentioned above:
What code do we use if we have 5 Locations and we want to show a field on 2 of them or hide field on 2 of them?
You can try as I mentioned above:
https://toolset.com/forums/topic/form-custom-logic-for-multiple-options/#post-2129537
1) show a field on 2 of them
[cred_show_group if="( ( $(location) eq 'Location1' ) OR ( $(location) eq 'Location2' ) )" mode="fade-slide"]
show a field on 2 of them
[/cred_show_group]
2) hide field on 2 of them
[cred_show_group if="( $(location) ne 'Location1' ) AND ( $(location) ne 'Location2' )" mode="fade-slide"]
hide field on 2 of them
[/cred_show_group]
Great thanks that worked!
So to hide fields we need to use AND instead of OR.