Create a rule-based Travelling information form

The following tutorial guide you through creating a rule-based form with several conditions. 

Case description

You have a travel agency and you have a multi-page form that is collecting the data of the passengers. 
In the first step of the form, you collect the passenger name and you also have a field - Are you travelling with children under 12 years old? If the user answers Yes, on the second step, you want to display fields where the user can enter the names and the passport numbers of the children - Child full name and Child passport number. If the passenger fills out the passport number, you want to display another set of these fields, in case the passenger is travelling with more than one child.  
If the passenger is travelling alone, you want to skip this step and go to the third step where there is a Submit button. After the users complete the form, you want to take them to one of the following pages: 

  • If they travel with children – to the page with terms for traveling with children.  
  • If they travel alone – to a page with the general travel terms. 

Procedure

To accomplish this, perform the following: 

Create the form 

  1. In the form body, drop the Textbox widget, label it Full name, and make it required. 
  2. Drop the Textbox widget, label it Passport number and make it required. 
  3. Drop the Multiple choice widget, label it Are you travelling with children under 12?, and configure it with two choices – Yes and No
  4. Drop the Page break widget. 
  5. On the next step of the form drop four Textbox widgets and label them in the following way: 
    • First child full name 
    • First child passport number 
      Make this widget required. 
    • Second child full name 
      Make the widget hidden. 
    • Second child passport number 
      Make the widget required and hidden. 
  6. Drop the Page break widget. 
  7. On the last step drop the Submit button widget. 
  8. In the Common header, drop the Form navigation widget. 
  9. Publish the form. 
  10. Create two pages – Travel information and Travel information for passengers with children

Create the rule for skipping Step 2 

  1. Open the form for editing and in the toolbar, click More actions » Rules » Create a rule
  2. Select field Are you travelling with children under 12? 
  3. In the next dropdown box, select is
  4. In the next dropdown box, select No
  5. In the next dropdown box, select Skip to step
  6. In the next dropdown box, select Step 3
  7. Click Create this rule. 

Create the rule for showing Second child fields 

  1. Click Create a rule
  2. Select field First child passport number
  3. In the next dropdown box, select is filled
  4. In the next dropdown box, select Show field
  5. In the next dropdown box, select Second child full name
  6. Click the plus icon. 
  7. In the next dropdown box, select Show field
  8. In the next dropdown box, select Second child passport number
  9. Click Create this rule

Create the rules for showing pages with information 

  1. Click Create a rule
  2. Select field Are you travelling with children under 12? 
  3. In the next dropdown box, select is
  4. In the next dropdown box, select Yes
  5. In the next dropdown box, select Go to page after submitting
  6. In the next dropdown box, select Travel information for passengers with children
  7. Click Create this rule
  8. Click Create a rule
  9. Select field Are you travelling with children under 12? 
  10. In the next dropdown box, select isn’t
  11. In the next dropdown box, select Yes
  12. In the next dropdown box, select Go to page after submitting
  13. In the next dropdown box, select Travel information
  14. Click Create this rule
  15. Go back the form editor and publish the form. 

Result

The following screenshot displays the list of rules:

Form fules

Was this article helpful?

Next article

Extend form rules