Form rules

Overview 

You use rule-based forms to collect information from the responders of the form and, based on their input, display different fields of the form. 

EXAMPLE: You have a form where the users fill out their address. You want to display the State field only to users whose address is in the United States. In this case, you can create a rule for this form that whenever a respondent selects USA in field Country, a field State is displayed. To other users the field State will be hidden.  

PREREQUISITES: You can create rules only for MVC forms.

You can create conditions for any field of the form and the actions that you can specify after the conditions are met are the following: 

  • Hide or unhide fields of the form 
  • Take the user to a specific step, in case of multi-step forms 
  • Take the user to a specific page of your website 
  • Display custom messages 

Precedence of rules

The rules are executed in the reverse order – the rule that you create last has the highest precedence. 

Procedure 

Define the conditions 

To create form rules, you must first create the form together with all of the fields and steps. Afterwards, to create a rule, perform the following: 

  1. In the backend of Sitefinity CMS, navigate to Content » Forms
  2. Open the form where you want to have rules. 
  3. In the toolbar, expand More actions » Rules. 
  4. Click Create a rule.
  5. Use the dropdown box to choose whether All or Any of the specified conditions must be met. 
  6. In the next dropdown box, choose the field which you want to specify conditions for. 
    The dropdown box lists all the fields that you have created in the form. 
  7. Choose how the selected field must meet the condition.  
    You can choose between: 
    • is – the user input must be exactly the same as what you entered in the next field. 
    • isn't – the user input must be different than what you enter in the next field. 
    • contains – the user input must contain what you enter in the next field. 
    • doesn't contain – the user input must not contain what you enter in the next field. 
    • is filled – the user must fill the field with any input.  
    • isn’t filled – the user must leave the field blank. 

      NOTE: If, as condition, you are using a field that is multiple choice or checkboxes, you do not have operators contains and doesn’t contain, because the input is predefined. 

  8. In the next input field, enter the condition that the field must meet. 

    EXAMPLE: If you want to create a rule for all users whose country is the USA, in the first dropdown box select Country, in the second dropdown box select is, in the input field, enter USA.

  9. To add more conditions, click the plus icon. 

Define the actions 

You can specify conditions for any of the fields of the form. When the form responder meets the conditions that you specify, you define the actions that are going to be executed. 

Under THEN…, perform the following: 

  1. In The dropdown box, select one of the following: 
    • Show field 
      In the next dropdown box, select which of the fields you want to display. 
      You can use this option in cases when you have already hided the field. 

      To hide a field, open the widget for editing and in select dropdown box Hidden field

      EXAMPLE: You want a field ABC to be hidden for everyone, except for a certain group of people. In this case, open field ABC for editing and select Hidden field dropdown box. Afterwards, create a rule to show field ABC, based on the desired condition. 

    • Hide field 
      In the next dropdown box, select which of the fields you want to hide. 

      NOTE: You can hide fields that have required input. 

    • Skip to step 
      You can use this option in case of multi-page forms.  
      In the next dropdown box, select the step where you want to take the user.
      The dropdown box lists all the steps that you have created in the form. 
    • Go to page after submitting 
      In the next step, select the page from your website where you want to take the user after the form is submitted. 
    • Show message after submitting 
      In the paragraph box, enter the text of the message that you want to display. 
  2. To add more actions, click the plus icon. 
  3. After you are finished defining conditions and actions, click Create the rule

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?