Rules and pre-populate

In the form designer, you can set up rules for the form. These rules could mean that certain information is filled in automatically (i.e. sections are pre-populated). As shown below, these rules can also be used to calculate scores or totals within the forms.

In the form designer, select the form you wish to work on. Click on Rules from the top menu, next to the export button.

To edit an existing set of rules, select one from the saved sets on the left of the window. Click “New” to start a new set, or select a rule and click “Delete” to delete a set.

The example used here is Kessler psychological form, where a score will be calculated from the values selected in the radio buttons.

 

 

Score rule: Calculates the sum of values assigned to answers of specified questions.

Select the rule type as Score.

In the Field section, select the name of the control (the name of the question). The questions used here are radio buttons, and the values of each button have been entered in the controls properties. So in this example, the score will be calculated by adding the values of the answers to questions 1 – 10.

In the second section, select a field (control) where the score will be automatically entered (i.e. this control will be pre-populated after you have answered the questions).

Validation Rule: The rule will only apply if the parameters are met.

Select the Type as Validation.

The “Field” is the name of the control. This example uses the “score” created above, but you could also just use the answer to a particular question.

Use the other fields to set out a parameter – entering a rule is similar to entering the parameters of a search query . The rule shown below will only be applied if the “score” on the form has a value greater than or equal to 16, and less than or equal to 29.

 

In the next two sections, enter instructions on pre-populating other parts of the form, for when the rule is or is not met. If a section is left blank, nothing will happen.

In the example below, if the requirements of the rule are met  if the validation is true the value of the Level control will automatically be entered. So, if the score of the form is 16-29, the Level control’ value will be Medium Risk. There is no action provided for when the rules are not met; therefore if the score is less than 16 or more than 29, nothing will happen.

    


Script Rule:
This rule is mostly for developers. It allows code to be inserted directly into the form.