Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • progressively show questions or information

  • show different questions or information according to previous responses

Process

...

Pre-reading

This guide assumes you’re familiar with how to create a Drupal webform.

See our other articles on forms and privacy.

Process

What you need to know

As for all Drupal forms, you need to embed your Drupal form in a Landing page in the CMS and . Then you publish or preview that Landing page for testing. (While there is a test function in Drupal forms, we prefer to test on a an SDP front end view.)

Applying and testing conditional logic on forms can take a fair bit of trial and error. You’ll do a lot of refreshing of your published/preview page while setting up and testing logic configuration.

Tip: It helps to have 2 browser windows open side by side - building the form in one and testing the preview in the other. Each time you make a change on the form’s logic, you hit refresh on the other screen to see if your change did what you expected or wanted it to do.

What you need to do

Follow this basic process:

  1. Plan your logic first (see below).

  2. Add all your questions and information in your form in the CMS.

  3. Progressively apply conditions and keep testing.

    • Hidden/visible logic can be applied on text fields (not just on 'questions').

    • More specific Specific logic is mainly used with radio and checkbox elements (e.g. Q2 is visible if the response to Q1 is 'no').

Info

Tip: build screen

When you are in the Build mode on a webform, you can see if conditional logic has been applied to a question or piece of text by looking in the ‘Conditional’ column. Click Edit to add logic.

image-20240919-012002.png

...

How to use conditional logic settings

When you’re in Edit mode of a form element (a question or piece of text), you’ll see a panel on the right of your screen. Click the ‘Conditions’ tab to apply settings.

...

Info

Numbering: Because you’re showing and hiding information and questions according to answers chosen on previous questions, it doesn’t make sense to number the questions on the final published form or tool. But while planning and testing the logic and building the form or tool, it’s really useful. You can see on the table below how the numbering helps state the logic/conditions. It also helps when configuring logic and you need to select items on a long dropdown.

...

To remove the default Submit button, click on the Edit button and tick the Hide submit button checkbox.

...