how do i add conditional statements to custom forms?

Form fields can be displayed conditionally. This is particularly helpful when using pull-down menus, check-boxes, or radio buttons to conditionally display other fields. To conditionally display a field, type the exact value from the unique ID column followed by an "=" sign and then the exact value it must equal in the show if column.

STEP 1: Add a new field.

Click on the text box to display a list of types of fields. Then click the green plus sign to add the field. (Figure 1)

Figure 1: Add a new field

STEP 2: Define your conditional statement.

Conditional statements use operators to define how a field should be displayed. Operators are:

  • (=): equals
  • (&&): and (takes precedence over ||)
  • (||): or

For example, if you are creating a new field that should only be shown if the field with unique ID "species" equal "mouse", you should type "species=mouse" in the show if fieldNote that for show if statements to work properly, each unique ID value must be different within one form and must be entered in the show if field exactly as it displays in the unique ID field. 

Examples:

  • species=mouse

Show this field if species is equal to mouse.

  • species=mouse&&color=white

Show this field if species equals mouse AND color equals white.

  • species=mouse&&color=white||species=mouse&&color+brown

Show this field if species equals mouse and color equals white OR if species equals mouse and color equals brown.

STEP 3: Save and review.

When you have finished adding your conditional fields, click the Save button. Then review your fields in the form. (Figure 2)

Figure 2: If your conditional statements display as they should, click Save.


Was this article helpful?