Use conditional logic for your forms

Current version: 10.3

Sitecore Forms lets you apply conditional actions to fields in web forms. You can apply conditions to create dynamic change forms that fine tune fields based on user entries. This can be convenient, for example, when you want to be able to send email messages to different departments according to user answers, when you want to show further questions when a user chooses a specific answer, or when you don't want to show the submit button until the user makes a particular choice.

Note

If the list of operators is empty for a custom field, you have to enable that field for the operators you want to use.

To add conditions:

  1. On the form canvas, click a form element to select it.

  2. In the relevant field, in the Form elements pane, in the Conditions section, click Edit Conditions.

  3. In the Conditions dialog box, add the relevant conditions. For example, if for a survey commentary you want to know the reasons for people rating your product poorly, you can display a multiline field. If visitors rate the product well, you can display the submit button. To do this, click Add condition and enter the IF and THEN fields. 

    Note

    Depending on the element you select, the available options from the drop-down list in the target field can differ. 

    You can add multiple actions for different target fields in a single condition group. If the conditions evaluate to true, all actions will be executed.

    Edit conditions for form elements dialog box
    Note

    The THEN statements can contain the following actions: show, hide, enable, disable, and go to page.

  4. Click Apply and save the form.

  5. The conditions now display in the Form elements pane. Click Edit conditions to change them.

    Click Edit conditions in the Conditions section to manage conditions

Do you have some feedback for us?

If you have suggestions for improving this article,