Set rules to show or hide fields in a form or task

With field conditions, you can conditionally display a form field based on what a user enters in another field. This is a great way to build a form that changes based on a user鈥檚 choices. It鈥檚 also great for displaying contextual notes or warnings as a user fills out a form.

This does not restrict entries to the fields, it just provides a contextual message. You can use entry validation to restrict the accepted entries to a field.

How conditionally displaying fields works

You can add contextual notes or warnings for web forms or manually assigned tasks. This method uses field conditions to display a field when another field meets a criteria. In this example, an instruction field is used.

In the following example, a warning appears under the Email address, Currency, and Negative numbers only fields when the entry is invalid. These warnings are just instruction fields set up to appear or disappear based on field conditions. This technique works for any field.

screen readers look here

鈿狅笍 Heads-up: These conditional instructions do not prevent or restrict a user from entering and submitting incorrect data, to all full entry validation, see Apply entry validation to fields

How to set up conditionally displayed instructions

There are three steps to creating the conditional instructions.

  1. Add the field that will be validated, such as a text or integer field.
  2. Add an instruction type field to act as the error or warning message.
  3. Set up a field condition so the instruction field appears when the wrong data is entered.

In these steps, we鈥檒l create the Email address field and validator from the above example. To follow along, create a new Workflow and add a web form to it, or edit an existing web form.

Step 1: Add the email address text field

  1. Add a web form to a Workflow. See the web form trigger article for How to create a web form trigger.

    screen readers look here
  2. From the Workflow Builder page, click open the Triggers and Fields section to head to your Instance Fields
  3. Select Add a Field.
  4. Add the field Email address.

Step 2: Add the email address validator

  1. Add another field, Email address validator and select the field.
  2. Select Type and set the type to Instructions. Select .
  3. Select Default Value and enter the warning message, such as 鈿狅笍 Must be a valid email address.
  4. Select .

Step 3: Add the field condition

  1. While still viewing the email address validator field, select the Advanced tab on the top, then select Conditions.
  2. Set the following conditions. See the condition options article for more details on how task and field conditions work.
    • If an @ is not in the field email-address and the field email-address is not empty.

      screen readers look here
      With the "and" operator, the instruction field is hidden unless both criteria are met.
  3. Select .

The conditional instructions are set up. Navigate to your web form URL to test out the results. Make changes to either field to adjust the results.

馃挕Tip: Reorder your web form fields to change where the warning will appear. Instruction fields can be moved around by adjusting its order among other fields.

Add more context using emojis

Optionally, add more context and readability with some emojis. Check out Emojipedia for a list of all universal emoji symbols. 鈿狅笍, 馃毇, 馃洃, and 鈽戯笍 are fun and universal.

Conditional instruction examples

With field conditions, many complex and practical conditional instructions are possible. A few helpful examples are provided below. Each example includes a description, and a plain-language explanation of the field condition.

Phone numbers: Set up rules to control formatting with ( ) and -.

  • If a ( is not in the field phone-number, and, If a ) is not in the field phone-number, and, If a - is not in the field phone-number, and, the field phone-number is not empty.

Currency: Make sure fields include a specific currency symbol.

  • If a is not in the field currency, and, the field currency is not empty.

All fields must be filled: Warn users to fill out two fields, and create a warning if only one is filled.

  • If the field field-1 is empty, or, the field field-2 is empty

PO numbers or unique IDs: If an ID should always start with PO-, validate that it starts with that.

  • If the field PO-number does not start with PO-, and, field PO number is not empty.

Number within a range: Set up rules so numbers must be greater/less than a value.

  • If the field value is greater than 0, or, the field value is less than 100, and, the field value is not empty.

Company email or email domain: Check if an email is a specific company email, rather than a personal email.

  • If the field company-email does not end with @companyname.com, or, gmail.com is in the field company-email, and, the field company-email is not empty.

馃挕Tip: See the Use a field reference to conditionally display text section of the field reference article for a way to conditionally display warnings if a field does or doesn鈥檛 exist.