I had a request for a complex form that needed to have questions appear based on how the user answers questions.
With a standard form you would need to create multiple forms for each scenario. Using the following instructions, you can sink your multiple scenarios into one form.
This form is like a mini knowledge base or decision tree. The top questions of the form are for information gathering, then a key question or (Branch Question) is asked that determines the path the user takes. In my form, there is one top-level Branch Question and depending on the path, the users are asked several other Sub-Branch Questions taking them on different paths within one path.
I created this form using components form my previous Blogs entries and then adding the Branch Questions. I used the Branch Questions with Hidden Sections and Conditional Formatting Rules for questions and answers. I thought I would be able to use the Hide this control option, but this option only grays out the radio button but not the Value when selected: field. I found the answer by adding questions that I want to hide in a section, and hiding the section based on the rules I created. By default, I hide all hidden sections. Once a user selects an answer on a Branch Question the question(s) in the hidden section appears. If they deselect the answer, the question(s) is hidden again.
The mini knowledge base or decision tree based form is very confusion trying to get it to work properly. I suggest you Visio the form out using if then paths. This will help you work out the rules.
Path A:
Top-Level Branch Question: Which path would you like to take?
· A
· B
· C
· D
Section (Not Hidden)
Sub-Branch Question 1: If A is selected un-hide this Section
· a
· b
· c
· d
Section (Hidden)
Sub-Branch Question 1: If a is selected hide this Section
Sub-Section (Not Hidden)
Sub-Branch Question 2: If b is selected un-hide this Section
Section (Hidden)
Sub-Branch Question 2: If B is selected hide this Section
Section (Hidden)
Sub-Branch Question 3: If C is selected hide this Section
Section (Hidden)
Sub-Branch Question 4: If D is selected hide this Section
Path D:
Top-Level Branch Question: Which path would you like to take?
· A
· B
· C
· D
Section (Hidden)
Sub-Branch Question 1: If A is selected hide this Section
Section (Hidden)
Sub-Branch Question 2: If B is selected hide this Section
Section (Hidden)
Sub-Branch Question 3: If C is selected hide this Section
Section (Not hidden)
Sub-Branch Question 4: If D is selected un-hide this Section
· a
· b
· c
· d
Sub-Section (Not Hidden)
Sub-Branch Question 4: If d is selected un-hide this Section
How to Hide Sub-Level Branch Questions that reside in sections: This can be tedious.
How to hide all sections by default: Using Path A
1. Add a Section control to the form.
2. Add your Sub-Branch Question inside the Section. (i.e. Sub-Branch Question 2: If B is selected hide this Section).
3. Double click on the Section to access Section Properties.
4. Click on the Display Tab.
5. Click on the Conditional Formatting… button.
6. Click Add…
7. Under If this condition is true: Select the Top-Level Question field.
8. Then select Is blank.
9. Check the Hide this control then click on OK.
How to hide Sub-Branch Questions that are not selected at the Top-Level Branch Question: Using Path A
1. Add a Section control to the form.
2. Add your Sub-Branch Question inside the Section. (i.e. Sub-Branch Question 2: If B is selected hide this Section).
3. Double click on the Section to access Section Properties.
4. Click on the Display Tab.
5. Click on the Conditional Formatting… button.
6. Click Add…
7. Under If this condition is true: select the Top-Level Branch Question field.
8. Select Is equal to.
9. Select answer (B) to the Sub-Level Branch Question that you want to hide the corresponding Sub-Branch Question. (i.e. Sub-Branch Question 2).
10. Select “or”.
11. Then repeat steps 7 through 10 for each answer to the Top-Level Question (C and D).
12. Then select Is blank.
13. Check the Hide this control then click on OK.
How to hide Sub-Branch Questions that are not selected at the Sub-Level Branch Question: Using Path A
To create a Sub-Branch within a Sub-Branch you need to add multiple sections. Each section will host the same question, but the answers will be different. I named the sections by question name and Option 1, 2 and 3.
1. Add a Section control to the form.
2. Add your Sub-Branch Question inside the Section. (i.e. Sub-Branch Question a: If B is selected hide this Section).
3. Double click on the Section to access Section Properties.
4. Click on the Display Tab.
5. Click on the Conditional Formatting… button.
6. Click Add…
7. Under If this condition is true: select the Sub-Level Branch Question field.
8. Select Is equal to.
9. Select answer (a) to the Sub-Level Branch Question that you want to hide the corresponding Sub-Branch Question. (i.e. Sub-Branch Question 1).
10. Select “or”.
11. Then repeat steps 7 through 10 for each answer to the Sub-Level Question (c and d).
12. Then select Is blank.
13. Check the Hide this control then click on OK.
I hope this helps!
~Brian