DEFAULT Instruction

The DEFAULT instruction provides an initial editable answer for the variable you specify (if it is unanswered).

Do not use the DEFAULT instruction in the script of a repeating dialog unless the instruction is used in conjunction with a conditional expression (on another variable in the same dialog, at the same REPEAT index) or a LIMIT instruction. If you use it by itself in a repeated dialog script, it will always add an unanswered dialog to the interview, which will produce an incorrectly assembled document.

The DEFAULT and SET instructions both assign answers to variables, but while the SET instruction sets the value of the variable when HotDocs processes the instruction (even if the variable is already answered), the DEFAULT instruction only sets the value of the variable the first time HotDocs processes the instruction and only if the variable is unanswered.

To default two or more options for a Multiple Choice variable, separate each option with a vertical bar (for example, DEFAULT MC Variable TO "Option1|Option2|Option3").

Instruction name Model After you drag and drop the model into the script tab:
DEFAULT DEFAULT ⟦VAR⟧ TO ⟦EXPRESSION⟧ Replace ⟦VAR⟧ with the variable you want to provide a default answer for.
Replace ⟦EXPRESSION⟧ with a literal value, variable, or expression that you want HotDocs to use as the default answer for this variable.

Example

For example, in the following script, the variable AttorneyName is defaulted to the literal value of Sam Jones:

DEFAULT AttorneyName TO "Sam Jones"

In this example, when HotDocs processes this script, it first determines whether AttorneyName has been answered. If it has, the DEFAULT instruction has no effect and HotDocs uses the answer already given. However, if AttorneyName has not been answered, HotDocs suggests the answer Sam Jones. When this variable appears during the interview, users can accept this answer by moving to the next dialog, or they can type a different answer in the answer field.

You can also use a DEFAULT instruction to suggest an answer that has already been given in the interview. For example:

DEFAULT TrusteeName TO ClientName

In this example, when HotDocs processes this script, it first determines whether TrusteeName has been answered. If it has, the DEFAULT instruction has no effect and HotDocs uses the answer already given. If Trustee Name has not been answered, HotDocs checks to see what answer has been given for Client Name and suggests that as the answer. It is important to note, however, that if Client Name is unanswered, TrusteeName will likewise be unanswered.

Download

After you download the example template, you can import the template to any workspace to see this example code in action.