Conditional Rules | Field Rules - Zoho Forms

Field Rules

Overview

Using the Field Rules, you can choose to show or hide certain form fields to your respondents or set certain fields as mandatory to fill in based on their previous responses on the form. This way, you can let your respondents see only the fields that are relevant to them by minimizing the questions that are irrelevant to them, or get input for the mandatory fields, and personalize and streamline the form filling experience for each respondent.
For example, if a user answers "Yes" to a question about whether they are a vegetarian, the form may display a series of questions about their dietary preferences and if the user chooses "No," the form may skip those irrelevant questions and move on to the next.

Field Rules


Field Rules in Zoho Forms can be configured for both basic and advanced scenarios.

Before we understand how Field Rules work, let us first understand what AND, OR connectors mean in Rules.

AND: If you require all the conditions in a rule to be satisfied at the same time to perform the intended action, use the AND operator.
OR: If you require at least one of the conditions in a rule to be satisfied to perform the action, use the OR operator.

Field Rules can be used in scenarios where actions are taken when all or any of the defined conditions are met. 
Assume you have three requirements (Condition 1, Condition 2, and Condition 3) to execute Action 1 and Action 2.
You can setup Field Rules to perform the actions when:
  1. All the 3 conditions are satisfied: 
              If Condition 1 AND Condition 2 AND Condition 3 are true -> then perform Action 1 and Action 2.
  1. Any of the 3 conditions are satisfied:
              If Condition 1 OR Condition 2 OR Condition 3 are true -> then perform Action 1 and Action 2.

Show/Hide fields with conditional rules

To show or hide certain fields based on a defined set of conditions, you can use Field Rules.
For example, assume you have a Room Reservation Form where you want to display the Additional Charges Applied only when your customers require additional services like, a room with a riverview, extra bedding, or a chauffeur for pick up.



     
To configure Field Rules to Show/Hide fields, 
  1. After building your form, navigate to the Rules tab.
  2. Under Field Rules, click Configure Now.

    Field Rule Configuration
  3. Define your conditions in the If section by choosing your form fields and the criterion they must satisfy. To add more than one condition, click theicon.
  4. A rule can be executed if at least one of the defined conditions is satisfied or if all of the conditions are satisfied. To define this, choose AND/OR connectors between your conditions. Click the connector to switch between AND / OR.
  5. In the Then section, choose the action Show or Hide fields and select the required fields in the Search Fields box to show up or hide fields in your form when the defined set of conditions are satisfied. Click the icon to define more than one action. 

    Travel rule configuration

    If your use-case requires the use of AND and OR operators within the conditions of the same rule, you can switch to Advanced Rules. Note that once you switch, all the Field Rules you will configure for your form moving forward will be in the Advanced Rule format. 
    If you wish to use a Subform's fields for configuring the Field Rules, you will have to switch to Advanced Rules.
  6. Once you have configured the rule(s), click Add to save and view the rule summary.

    Rule Summary

  7. To add more rules, click in the top right corner. 
  8. You can enable or disable the rule using the toggle on the right. This allows you to temporarily pause the rule's logic without having to delete it.
  9. To filter rules, click the filter icon in the top-right corner. 

Using Grouped Choices with conditional rules

You can configure field rules to work with grouped choices of a dropdown field.
To do so, 
  1. Go to Rules Field Rules and click Configure Now.
  2. Define your conditions in the If section by choosing your form fields and the criterion they must satisfy. To add more than one condition, click theicon.
  3. A rule can be executed if at least one of the defined conditions is satisfied or if all of the conditions are satisfied. To define this, choose AND/OR connectors between your conditions. Click the connector to switch between AND / OR.
  4. Under Then section, you can choose between Show Grouped Choices or Hide Grouped Choices.
  5. Click Add to view the rule summary.
  6. To add more rules, click in the top right corner. 
  7. You can enable or disable the rule using the toggle on the right. This allows you to temporarily pause the rule's logic without having to delete it.
  8. To filter rules, click the filter icon in the top-right corner. 

Set Fields as Mandatory with conditional rules

Although you can choose certain fields to be mandatory in the Properties pane of the respective fields on your form builder, you can make certain fields as mandatory if the set conditions are satisfied.
For example, assume you have an Event Registration form, and if your respondent chooses to bring guests, you can make the number of guests field mandatory in order to get a head count.

Set Fields as Mandatory with conditional rules

To configure Field Rules to set fields as mandatory,
  1. After building your form, navigate to the Rules tab.
  2. Under Field Rules, click Configure Now.

    Field Rule Configuration

  3. Define your conditions in the If section by choosing your form fields and the criterion they must satisfy. To add more than one condition, click theicon.
  4. A rule can be executed if at least one of the defined conditions is satisfied or if all of the conditions are satisfied. To define this, choose AND/OR connectors between your conditions. Click the connector to switch between AND / OR.
  5. In the Then section, choose the action Set Fields as Mandatory and select the required fields when the defined set of conditions are satisfied. Click the icon to define more than one action. 

     Set Fields as Mandatory with conditional rules
  6. Once you have configured the rule(s), click Add to save and view the rule summary.
  7. To add more rules, click in the top right corner. 
  8. You can enable or disable the rule using the toggle on the right. This allows you to temporarily pause the rule's logic without having to delete it.
  9. To filter rules, click the filter icon in the top-right corner. 

Note:
  1. The fields involved with the Set Fields as Mandatory action cannot be marked as mandatory in the field properties of the form builder.
  2. Fields that have been marked as mandatory in the form builder properties will not available to use with the Set Fields as Mandatory action in the Field Rules.
  3. The Set Fields As Mandatory action is supported only if you have switched to Advanced Rules.

Set Value and Hide/Disable fields with conditional rules

In Show/Hide fields with conditional rules, you show or hide a field based on conditions — showing it when the respondent needs to enter data, hiding it when it is not relevant to them. With Set Value, the behavior is different. Regardless of whether the field is visible or hidden, a value is automatically set and submitted with the form. The two action types only differ in what the respondent sees:
  1. Set Value and Hide: The value is set and the field is hidden from the respondent. The value is still submitted silently in the background.
  2. Set Value and Disable: The value is set and the field is shown to the respondent, but they cannot edit it.
For example, assume you have a Software Installation Request form. If an employee belongs to the Software Engineering department and enters the approval code IT-001, the Reason field can be automatically set to "Pre-approved as per IT policy" and hidden using the Set Value and Hide option. Respondents cannot fill it in. 

Alternatively, you can use the Set Value and Disable option to keep the field visible but disabled. This allows the employees to see the pre-approved reason field but prevents them from editing it. 

For employees from other departments or without the approval code, the Reason field remains visible and editable so that they can provide their own reason for the request.
Set Value and Hide




In this example, the fields used in the If section (Employee Department and Approval Code) are the condition fields. The field selected in the Then section (Reason) is the action field (target field). Since the value is entered using + Add Input Manually, no source field is used in this example. If you select a field instead of entering a manual value, that field becomes the source field, and its value is copied to the action field when the rule conditions are met.

Notes
Note: The Set Value And Hide, Set Value and Disable actions are supported only when you have switched to Advanced Rules.

To configure a Set Value and Hide/Disable action in your field rule,
  1. After building your form, navigate to the Rules tab.
  2. Under Field Rules, click Configure Now or + Rule if rules already exist. 
    Configure Field Rules

  3. Make sure you are in Advanced Rules mode. If not, click Switch to Advanced Rules in the top-right corner of the New Rule pop-up.
  4. Define your conditions in the If section by choosing your form fields and the criterion they must satisfy. To add more than one condition, click theicon.
  5. A rule can be executed if at least one of the defined conditions is satisfied or if all of the conditions are satisfied. To define this, choose AND/OR connectors between your conditions. Click the connector to switch between AND / OR.
  6. In the Then section, click the action dropdown and select either Set Value and Hide or Set Value and Disable. Click the icon to define more than one action. 

  7. In the Search Fields box, select the field whose value you want to set.
  8. In the as input on the right, configure the value to be set. You can either:
    1. Select a field from the dropdown — the value of that field will be dynamically copied to the target field when the condition is satisfied.
    2. Click + Enter Value Manually — enter a static text, number, or date to be set when the condition is satisfied.
  9. Once you have configured the rule(s), click Add to save and view the rule summary.
  10. To add more rules, click in the top right corner. 
  11. You can enable or disable the rule using the toggle on the right. This allows you to temporarily pause the rule's logic without having to delete it.
  12. To filter rules, click the filter icon in the top-right corner. 


Supported Field Types for Set Value 

The Set Value action supports assigning values between compatible field types. In general, the action field (target field)  and the source field should belong to the same or compatible data type.

Action Field Types

Supported Source Field Types

Name

Name

Address

Address

Single Line / Regular Expression

Single Line, Regular Expression, Email, Website, Dropdown, Radio, Number, Slider, Rating, Choice fields (text values)

Phone

Phone

Email

Email, Choice fields (email values)

Website

Website

Number / Slider / Rating

Number, Slider, Rating

Decimal / Currency

Number, Slider, Rating, Decimal, Currency, Choice fields (numeric values)

Dropdown

Dropdown

Radio

Radio

Checkbox

Checkbox

Multiple Choice

Multiple Choice

Image Choice

Image Choice

Terms and Conditions

Terms and Conditions

Yes/No

Yes/No

Decision Box

Decision Box

Date

Date

Day Availability

Day Availability

Date-Time

Date-Time

Date-Time Availability

Date-Time Availability

Time

Time

Month-Year

Month-Year


NotesNote:
  1. In field rules, an action field can only be configured with one type of field rule action — Show, Hide, Set Value and Hide, or Set Value and Disable.
  2. If both Prefill and Set Value action are configured for a field, the Set Value expression applies when the field rule condition is met, otherwise the prefill value applies.
  3. Fields that are hidden or disabled in the form builder cannot be used as target fields for Set Value actions.
  4. If the same field is configured with a Set Value action across multiple rules, the last satisfied rule’s value will be applied.
  5. Action fields must be placed after Condition fields on the form.
  6. A field cannot be used as a condition field and an action field in the same rule. 
  7. In a Set Value expression, you can set the value of the action field in two ways — enter a value manually or reference a source field. A source field must be placed above the action field in the form.  
  8. When the action field is a single component field (Single Line, Number, etc.) and the source field is a multiple component field (Address,Name etc.), the values from all components will be combined and added as comma-separated text.
  9. When the action field is a multiple component field (Address,Name etc.) and the source field is a single component field (Single Line, Number, etc.), the value will be added to the first component only. The remaining components will be left empty.
  10. Set Value actions are available only in the forms that use the latest version.
  11. Inline OTP Verification cannot be enabled for action fields configured with Set Value actions. 
  12. Fields with Inline OTP Verification enabled cannot be used as action fields for Set Value actions.


Restrictions while configuring Field Rules

  1. A Condition field should come prior to the Action field in the form builder for the rule to work.
    For example, if you have configured a Field Rule to show the Email field only when the user chooses the mode of communication to be Email :
     Show Email field if communication mode is selected as Email

    In the above rule,
    Condition field -> Mode of communication
    Action field -> Email
    For this rule to work, the Condition field ( Mode of communication ) should come prior to the Action field ( Email ) in your form.
    If you try to change the position of these fields in the form such that Email field comes prior to the Mode of Communication field, you will encounter an error.


  1. Except for the Set Fields as Mandatory action of the Field Rules, subform fields cannot be used to configure the conditions or actions.
    NotesNote : To set Field Rules by comparing the values of two fields within a form, use Field-to-Field Comparison in Advanced Rules. Learn more


Supported Operators

  1. IsChecks if the selected field is equal to the set value
  2. Is Not: Checks if the selected field is not equal to the set value
  3. Is Empty: Checks if the selected field is empty
  4. Is Not Empty: Checks if the selected field is not empty
  5. Contains: Checks if the selected field contains a value in the condition
  6. Not Contains: Checks if the selected field does not contain a value in the condition
  7. Contains Any Of: Checks if a field contains any of the selected choices
  8. Contains All Of: Checks if a field contains all of the selected choices
  9. Contains None Of: Checks if a field contains none of the selected choices
  10. Starts With: Checks if the selected field starts with the given value
  11. Ends With: Checks if the selected field ends with the given value
  12. Other Choice Is Not Empty: Checks if a value is entered in the Other choice
  13. Is Any Of: Checks if any of the choices chosen in the condition match
  14. Is None Of: Checks if none of the choices chosen in the condition match
  15. Less Than: Checks if a number is less than a given value
  16. Greater Than: Checks if a number is greater than a given value
  17. Less Than or Equal To: Checks if a number is less than or equal to a given value
  18. Greater Than or Equal To: Checks if a number is greater than or equal to a given value
  19. Between: Checks if a number/date is between 2 given values
  20. True:  Checks if logical TRUE value is returned
  21. False: Checks if logical FALSE value is returned
The following table lists the operators that can be used with the corresponding field types to form a rule criteria in the If section:

   Field Types
   Supported Operators
    Name
   Contains
   Not Contains
   Is Empty
   Is Not Empty
Single Line
Multi Line
Phone

   Is
   Is Not
   Is Empty
   Is Not Empty
   Contains
   Not Contains
   Starts With
   Ends With
Number
Decimal
Currency
Rating
Formula

   Is
   Is Not
   Is Empty
   Is Not Empty
   Less Than
   Greater Than
   Less Than or Equal To
   Greater Than or Equal To
   Between
Address
   Contains
   Not Contains
   Is Empty
   Is Not Empty
Email
Website
   Is
   Is Not
   Is Empty
   Is Not Empty
   Starts With
   Ends With
Date
Date-Time
   Is
   Is Not
   Is Empty
   Is Not Empty
   Less Than
   Greater Than
   Between
Time
   Is
   Is Not
   Is Empty
   Is Not Empty
   Less Than
   Greater Than
Decision Box
Terms and Conditions
   True
   False
Radio
Dropdown
   Is
   Is Not
   Is Empty
   Is Not Empty
   Starts With
   Ends With
   Other Choice Is Not Empty
   Is Any Of
   Is None Of

Multiple Choice
Checkbox
Image Choices
   Contains
   Not Contains
   Is Empty
   Is Not Empty
   Contains Any Of
   Contains All Of
   Contains None Of

Matrix  Choice   Is
   Is Not
   Is Empty
   Is Not Empty
Slider
   Is
   Is Not
   Less Than
   Greater Than
   Less Than or Equal To
   Greater Than or Equal To
   Between
Signature   Is Empty
   Is Not Empty


InfoRules are case-sensitive which means the conditions trigger actions only when the case of the text in the defined condition matches the case of the respondent input. Check out an example to understand this better.