How to Hide or Show Fields in Forms
At Form ASAP, we provide a dedicated component called Rules and Logic to add dynamic behavior to your forms. This feature allows you to create conditions that hide or show specific fields based on user input. Follow the steps below to configure such rules.
Example Scenario
Imagine you have a radio button field with the following options:
-
Opera
-
Firefox
-
Edge
-
Chrome
-
Other
When a user selects Other, you want a text field labeled Please Specify to appear, allowing the user to specify their browser.
Step-by-Step Guide
-
Create the Fields:
-
Add a radio button field with the options: Opera, Firefox, Edge, Chrome, and Other.
-
Add a text field labeled Please Specify.
-
Save the form after creating these fields.
-
-
Navigate to Rules and Logic:
-
Open the Rules and Logic section from your form editor.
-
-
Create a New Rule:
-
Click on Create Rule and give your rule a descriptive name, such as "Show Specify Field."
-
-
Add a Condition:
-
Click on Add Condition.
-
Set the Source Field to the radio button field.
-
Select the condition type Is Option Selected.
-
Choose the option Other.
-
-
Add an Action:
-
Click on Add Action.
-
Set the action to Show. By default, the target field will remain hidden.
-
Choose the Target Field as the Please Specify text field.
-
-
Configure Additional Settings:
-
If required, make the Please Specify field mandatory. The system will automatically make it optional when the condition is not met.
-
-
Save and Test:
-
Save the rule and test the form to ensure that selecting Other displays the Please Specify field dynamically.
-
Advanced Features
-
Multiple Conditions:
-
Add more than one condition to your rule if necessary.
-
Choose between All or Any conditions:
-
All: All conditions must be met for the action to apply.
-
Any: If any condition is met, the action will apply regardless of other conditions.
-
-
Limitations
The following field types cannot be used as Source Fields for conditions:
-
Color
-
Birthday
-
DateTime-Local
-
Note
-
Hidden
-
Matrix
-
Tel
-
H1, H2, H3, H4, H5, H6
These fields can still serve as Target Fields, allowing you to hide or show them based on other field values.
Summary
Using Rules and Logic, you can create dynamic forms in Form ASAP with ease. This functionality enhances user experience by displaying relevant fields only when needed. Experiment with different conditions and actions to build forms tailored to your needs!