Chapter 6. Advanced features

Conditional Branching

If you want different questions to be presented to the user based on the answers they give, you can use the show/hide quesiton feature. In BF Survey Plus conditional branching was achieved using the next question id, but the new version BF Survey does things a bit differently.

In each question you will now see the "Hide this question if" and "Show this question if" fields on the visibility tab, and this controls when a question is shown or hidden. By default, all quesitons are shown.

This feature is designed to work with radio or checkbox question as the prior question that triggers the show/hide.

[Warning]Warning

For multipage surveys, each page must have at least one question that is always visible. You can get round this issue by grouping questions using the parent item.

The DB Field Name for questions used with show/hide must not end in a number. You can put an underscore at the end to avoid this issue.

Questions that are sometimes hidden and sometimes shown cannot be set as mandatory. Only questions that are always visible can be set to mandatory.

As an example, we will assume that we are interested to know the number of birds that a person owns. Obviously this question is only relevant to people who own birds, so we don't want to show this to everyone. In this scenario, we have two questions grouped onto the same tab using a heading question, and the second question "How many birds do you have?" will be only visible when the person indicates that they like birds.

On the visibility tab for the "How many birds do you have?" question, we select the "What is your favourite pet" question in the show field, and select the option of bird. Initially this question will be automatically hidden, and it will now only be shown if the user selects the bird option in the previous question.

As you can see, initially the second question is hidden.

The second question is still hidden when the user selects "Dog" and "Guinea Pig", as they don't match the show criteria.

Now that the "Bird" option is selected, the second question becomes visible. This is regardless of the other options selected. This is all done using javascript, so the question immediately appears without the need of form submission.

The hide feature works in a similar way, except it will initally show the quesiton by default, and only hide it when specific options are selected in a different question.

[Warning]Warning

Show question may override the hide question, so don't use both for the same question.

Go to top