skip to primary navigationskip to content
 

Branching form

Forms which branch depending upon the user's responses

As an example, a form which asks different questions depending on the type of user would have a branch for each type. E.g. User types of Staff, Undergraduate student, and Postgraduate student.  

Each branch of the form should be collected within an umbrella folder as each will have their own final page/form folder i.e. you should not branch and then link back the branches together at the end with a single final page. This is because the transfer of previously input data from page to page can get unwieldy and complicated.

Firstly create a top-level folder to hold the entire contents of the form including its branches. Set its default view to the first page/form folder of the form. Then, under this top-level folder, create umbrella folders for each branch. Set their default view to the first page of that branch. An example showing this hierarchy:

 

Of course, if the form is not a large one it may be sufficient to just have the one top-level folder and a form folder for each branch.

Add the necessary form fields to each form folder. Pass on the data collected from the previous form page using replica hidden form fields. [See the examplegiven for large forms]. If you have form pages in sequence before/ after any branching, to enable moving from one page to the next use the form folder's Edit tab, Overrides tab to configure the Custom Success Action box with the text:

traverse_to:string:page-name

- where 'page-name' is the short name of the following page/form folder.

 

To branch from a form folder there are two tasks to do within the form folder at which the branch point occurs:

1. Add a Selection Field object and in its Options section, set the values to the short names of the first form folder of each branch. In our example above, the Staff registration form folder has the short name of 'staff', the Undergraduate student registration form folder has the short name of 'ug-student' etc, so the Selection Field object within the Library Membership Registration form folder looks like this:

 

2.  Insert the following text into the Edit tab, Overrides tab, Custom Success Action box:

traverse_to:request/form/selection-field-object-name

So for our example, we would have the following in the Library Membership Registration form folder:

To summarise: The Custom Success Action box sends the user to the next page. How it sends the user depends on whether the next page is a sequential one or a branch. If sequential, it uses the next page's short name. If a branch, it uses the short name of a Selection Field.

 

The last form folder of each branch is the final page and so must be configured to produce the desired output.