Conditional Display and/or Require

Sometimes you may want to only show or only require (or both) a field if other fields are answered or answered a certain way. For example, you may have a request that looks like:

AcctRequest1

But you only want to display the Account ID field if it is a remove request, and the Account ID should be required for remove requests.

To do this, we follow the following steps:

  1. In the builder, select the Request Type question. You will need to use the values, rather than the labels of the answers, and they are not necessarily the same. You will want to check on what the values are. In this case, they are the same.Type
  2. Then click on the question we want to control, Account ID. We will be adding Display and Validation conditions.AcctRequest2.1
  3. When you click on Display, the display options are shown. In this case, it is currently visible, but we only want it to be visible some of the time, so we are going to select Conditional.Display1
  4. Clicking Conditional will display the Condition field. If the (javascript) logic entered in the Condition field evaluates to true, the field will be shown. Note that the “Omit the field value when hidden” will delete the field entry when the field is hidden. In this case, that is probably desirable.DisplayConditionalBlank1
  5. Then we will use the Variables drop down to build our Condition.DisplayConditionalMenu1

    which will be

    values('Request Type') == "Remove"

    DisplayConditionalFilledIn

  6. Then we move on to the Validation section. When this is opened it will display a similar conditional.ValidationwithDisplay
  7. Again, select Conditional. This time, when the Condition field displays, we can just copy-paste the condition from the Display section, since we want them to be the same.ConditionalValidation

Now you are done and the page will look like this when it loads:

ConditionalDisplayExample

Like this when you select “Remove” (note the red star for the required field):

ConditionalDisplayExamplept2

And like this if you try to submit a type of Remove without an Account ID (note the Default Validation message):

ConditionalDisplayDefaultMsg