Rules

Use Rules in forms to control the behavior of a form. Form rules provides the ability to:

  • Apply logic to forms and make them more dynamic

  • Adjust forms when user enters data

  • Display only relevant information to users

  • Improve the accuracy of data that is submitted

An example of a rule is when you want to show a set of controls only when a user is from Australia, based on a query run on the browser URL. See this example in action.

Another example is when you want to compare values between two of the same controls. In a form, there could be two Email fields: Email and Confirm Email. You can create a rule that checks if the user enters the same email address in these two form fields. If true, the form can be submitted. Else, an error message appears.

Types of rules

There are two types of rules you can create for forms.

Form rules

Use form rules to set behavior and values for fields. For example, when users enter data into form fields or when default values of controls determine the behavior of the form on load.

You can modify the values and behavior of form fields using form rules. For example, you want users to enter more details if they select Yes in an RSVP online form. For step-by-step instructions, see Step-by-step example: Create an RSVP form.

Submit rules

Use submit rules to set behavior and values for fields which occur when user submits a form. You can use submit rules to set custom validation messages when submitting a form. For example, you can specify a custom validation message to be displayed if the user doesn't enter a valid value in a form field.

Add rules to your form

  1. Click Rules tab at the top of the forms designer.
  2. Decide which of the following rules you want and complete the following:
    • Form Rules: Click Add form rule to add rules to set behavior and values for fields which occur when users enter data into the form.
    • Submit Rules: Click Add submit rule to add rules to show custom validation messages, which display when users attempt a form submission.
  3. Complete the fields for the new rule as follows:
    • For Apply to, select the form or a repeating section to apply the rule to. (Available only if you have a repeating section control in the form.)
    • For Name, type a user-friendly name for your rule.
    • For If, define one or more conditions triggering the rule.
    • For Then, define one or more actions to occur if the rule is true.
    • For Else, define one or more actions to occur if the If/Then clause is not true.

    Note: Click Insert if you want to insert form controls or variables with applied formulas. For more information on the Insert window, see Insert variable dialog fields, buttons, and settings.

  4. Click Create rule to save your configuration.
  5. To see your new rule in action, click the Preview tab on the upper left of the forms designer.

For more information on the fields and settings of the Rule builder page, see Rule builder fields, buttons, and settings.

Search for a rule

You can search for a rule using the rule name, variable, or control name. All rules that match the search text are displayed.

  1. Click Rules tab at the top of the forms designer.
  2. In the Form rules or Submit rules sections, enter the text you want in the Search box.
  3. All rules containing the rule, control or variable name are displayed.

    To clear the search, click x on the right of the Search box.