Create conditional logic in your forms

Written by Julie Trenque

Updated on 11/10/2023

1 min


Was this content useful?

You can trigger specific actions based on the values provided by your visitors when they fill out your form. You can show or hide form elements or screens according to each user and the way they interact with your widget.

Show/hide an element based on the value filled by the visitors in the form

It is possible to set the appearance or disappearance of elements or screens according to the values already entered by visitors in the form elements. For example, if a specific checkbox is selected, a text area may appear to invite the visitor to explain his choice in more detail.

To do this, you need to create an Element 1 (displayed by default), on which depends an Element 2 (hidden by default). A specific action on Element 1 will trigger the display of Element 2. An Event must be set for this triggering to take place.

Use case

We create a first selectbox and would like to have a second selectbox displayed or not depending on the visitor’s choice in this list of options.

In the settings part of the first selectbox, we indicate 2 options:

  • Latest products
  • Blog updates

For visitors who chose Latest products, we add a second selectbox (hidden by default) to choose between:

  • All products
  • Clothes
  • Shoes

In the Events part of the Widget Studio, we will have to create a specific event to trigger the display of the second selectbox.

We add an event and we select Form.

In the next screen, we select By element form value.

Then we select our first selectbox element.

We select the value we are interested in, i.e. Latest products.

Once this trigger has been configured, we add an action of type Elements.

Finally, we pick the second selectbox element we created.

The result of the configuration of this event is as follows:

At the widget display level, here is the impact of this conditional logic:

  • In this article :