ERRORTEXT System Local Variable

The ERRORTEXT is a system local variable (available only in dialog scripts) that enables you to set an error message to display on a dialog when the error condition you specify occurs during the interview.

Using ERRORTEXT can help you guide your template user to provide adequate answers to questions in your interview. The message you display in your error should tell your template user how to fix the conditions which caused the error.

Instruction name (OR Expression name) Model After you drag and drop the model into the script tab:
Expression returns:
ERRORTEXT SET ERRORTEXT  TO ⟦TEXT⟧  Replace ⟦TEXT⟧ with a text string you want the error message to display. A text value.

Example

Say you work for a delivery company that does not deliver to certain areas of the United States, you could use an ERRORTEXT expression to warn customers when they type the name of a state that is outside of your delivery area. Your dialog script might look something like this:

IF state = "Hawaii" OR state = "Alaska"

SET ERRORTEXT TO "Unfortunately we do not deliver outside the continental US."

END IF

If a customer types either "Hawaii" or "Alaska,"  the error message appears and they must change their answer before continuing with the interview.

HotDocs blocks the user from continuing to the next dialog, because HotDocs handles an ERRORTEXT expression like a required variable. You can use this feature to generate error messages if the user leaves a necessary question unanswered in an interview.

In a similar scenario to the example given above, suppose your delivery company needs to make sure that customers type the name of a country when filling out their address. Your script, to alert the user when they leave the country field blank, might look something like this:

IF !ANSWERED (Country)

SET ERRORTEXT TO "Country is a required field."

END IF

Download

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