Lesson 7: Make Answer Fields Conditional

Overview

Sometimes your templates contain optional fields, which should only be answered when certain conditions are met. In Lesson 8: Make Paragraphs Conditional (page 76), you learned how to create IF instructions to include or exclude text in an assembled text document. In a form template, you can also use IF instructions to enable or disable a field, which allows a user to enter an answer only if the conditions are met.

The Medical History section of the life insurance application template contains explanation fields, which only apply if the corresponding True/False variables indicate that the user has those particular health conditions. You can make these fields conditional, meaning that the user cannot enter an answer unless the corre­sponding True/False variable is true.

Start the Tutorial

If you are continuing immediately from Lesson 6, skip the instructions for opening the template and proceed to “Make Fields Conditional.”

If you closed the template at the end of Lesson 6, complete the following steps.

To open the tutorial template

  1. Open HotDocs Developer (choose Start > Programs > HotDocs 11 > HotDocs Developer). The My Test Templates library appears.

    If the My Test Templates library does not appear, choose Open Library (File menu), select the library in the default Libraries folder (for example, My Test Templates.hdl), and click Open.

  2. Select Life Insurance Application and click edittemplate.jpgEdit. The template appears in HotDocs Automator, ready for you to edit.

Make Fields Conditional

You can make a field conditional at the Field Properties dialog box. The simplest conditions are based on True/False variables, but you can also make fields condi­tional on the answers to several variables using an IF expression. In the life insurance application, you will make the explanation fields in the Medical History section conditioned on single True/False variables.

To make the Explain Smoking field conditional

1. Select the Explain Smoking field, and then click the properties00305.jpgField Properties button. The Field Properties dialog box appears.

inset_800308.png

2. Click the if.jpgIF Field button next to the Condition box. The IF Field dialog box appears.

inset_2600311.png

You want the user to enter an explanation of smoking only if the applicant has smoked within the past 12 months—in other words, only if the True/False variable Smoker is true.

The IF True/False Variable option is used when the conditions are a simple either/or choice. The IF Expression option is used when the conditions require more complicated logic.

3. With IF True/False Variable selected in the Field type group, select Smoker from the True/False variable drop-down list.

inset_3000312.png

4. Click OK at the IF Field dialog box. An IF instruction is inserted in the Con­dition box.

The next field you will make conditional is the Explain Heart Trouble field.

To make the Explain Heart Trouble field conditional

1. Select the Explain Heart Trouble field. The Field Properties dialog box changes to show properties of the selected field.

You can also enter an IF instruction directly in the Condition box, rather than using the IF Field dialog box.

2. Click the if00313.jpgIF Field button next to the Condition box. The IF Field dialog box appears.

3. With IF True/False Variable selected in the Field type group, select Heart Trouble from the True/False variable drop-down list.

inset_8800316.png

4. Click OK at the IF Field dialog box. The IF instruction is inserted in the
Condition box.

inset_8900317.png

On Your Own

You can leave the Field Properties dialog box open as you modify the field proper­ties for the remaining fields in the Medical History section. Follow the instructions in the previous section, and condition each remaining text field upon its corre­sponding True/False variable. Specifically:

§ The Explain High Blood Pressure field should be conditioned upon the High Blood Pressure variable.

§ The Explain Diabetes field should be conditioned upon the Diabetes variable.

§ The Explain Immune Disorder field should be conditioned upon the Immune Disorder variable.

When you are finished making these fields conditional, close the Field Properties dialog box.

Conclusion

You are now finished with this lesson. In it, you learned how to make answer fields conditional based on the answers to corresponding True/False variables. This prevents a user from entering answers in fields that are not applicable based on the user’s other answers.

Click the save00318.jpgSave Form button to save the template. If you do not want to go on to Lesson 8 at this time, choose Exit (File menu). Then exit HotDocs.