Fields Visibility offers the possibility to control the visibility of certain fields in your Input Form widget. By using this feature, you are able to define conditions to hide some fields based on the values of other fields.
For example, the field after the feedback type has been changed based on the value of the feedback. If the feedback type is suggestion then we show the What is your suggestion? field, and if the feedback type is bug then we will show the What is the problem? field.
Benefits of Fields Visibility:
- Free up space in your form by hiding undesired fields at certain times.
- Separate your fields. You no longer need to put two labels in a text field and then handle their values differently based on other fields.
- Organize the data posted. If you hide a field, it won't be posted along with the rest of the fields that are visible.
To use field visibility, you need to create conditions to define when a field will be visible. You can start creating conditions by editing in your Input Form Widget and then heading into the Fields Visibility Tab.
By default when you enter the tab you will see one of these boxes for every variable that you have.
If you don't set any visibility conditions on a field, it will always be visible.
Once you define at least one visibility rule, the field will only appear if it matches one of the conditions. You can add up to 10 visibility conditions.
To create a condition, press the Add Rule button. By doing so, a new row will appear with some information for you to fill in.
- In the select a variable field you can choose a variable that was previously defined in the Main Configuration tab, this is the variable that the condition will be based off of.
- In the condition field you specify the comparison type that will be used against the previously defined variable's value.
By configuring a row, the field suggestion_feedback will only appear when the chosen variable's field matches the condition specified.
If you are still having trouble understanding what each field in the row is supposed to do, try to read the whole line as text. For example:
equal to something
this field will be visible.
To facilitate understanding, this is what the example in the beginning of this article would look like:
Also keep in mind that we only covered field visibility here, to learn more about how to configure each form field access the Input Form Widget documentation.