HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

ANSWERED Function

The ANSWERED function evaluates whether the template user answered the variable or dialog you specify in the interview.

When using dialog within the ANSWERED function, even if only one variable in that dialog is answered, the function will return true.

You can use the ANSWERED function to check if a value has been assigned to a variable or dialog. It can serve many functions, such as acting as a condition in IF statements to control the behavior of your interview. This can be helpful when you want a variable placeholder in the template to display its contents if answered and not appear if unanswered (see first example below). In other cases where you want to be precise about when instructions occur depending on the answered state of a variable or dialog, the ANSWERED function can do this. (see second example below).

If you are testing whether a user has answered a variable or dialog, you must make sure the variable or dialog is presented to the user using a custom interview or is explicitly ASKed in the template. Using the ANSWERED (VAR, DIALOG) function alone will not automatically require HotDocs Author to display the variable or dialog to the user.

Function name ANSWERED
Usage model ANSWERED ( v:VAR,DIALOG)
Parameters The ANSWERED function requires you to replace one of two parameters:

v:VAR

The function evaluates whether or not the user has answered the variable.

DIALOG

The function evaluates whether or not the user has answered the dialog.
Result A true or false value.

Example

Suppose you have a dialog that gathers information about a decedent (Decedent Information). From within this dialog script, a user could open an inserted dialog that asks questions about the decedent's assets (Decedent's Assets). Later in the template, you could ask additional questions based on whether these dialogs have been answered:

IF ANSWERED( Decedent Information ) AND ANSWERED( Decedent's Assets )
   ASK Asset Distribution Information
END IF

Here is an example using ANSWERED with a variable within a template. You may place a variable for the second line of an address (Client Address 2) in a custom dialog; however, not all users will provide information for that variable. In the template text, you can surround Client Address 2 with an IF expression that merges that variable into the document—only if the user answers it:

[Client Name]
[Client Address 1]
[IF ANSWERED( Client Address 2 )]
[Client Address 2]
[END IF]
[Client City], [Client State] [Client ZIP]

In this template's layout, the ANSWERED expression is used with an IF expression to insert or remove Client Address 2, based on whether the user has provided that information. (Without it, the default unanswered text, ***Client Address 2***, would be inserted in the assembled document.)

Even if a user chooses not to answer a variable that has been tested using the ANSWERED expression, HotDocs will still warn that it is unanswered. If you don't want a warning to appear, clear Warn when unanswered at the Behavior tab of the Variable Editor (for example, see the Text Variable Editor.)