ERRORTEXT

Returns a Text value

ERRORTEXT can only be used in a dialog script.

Use the ERRORTEXT expression to create an error message that appears when the error condition you specify occurs during an interview. If a user provides information that triggers the error message, the user must correct the error before HotDocs enables access to the next dialog.

If you make the ERRORTEXT expression conditional, the error message appears both as a popup, and at the top of the dialog, accompanied by a red error symbol. If you do not make the ERRORTEXT expression conditional, as soon as the user clicks the dialog, the error message appears and displays continuously at the top of the dialog. In this case, there is no accompanying popup.

You can make the error conditional by adding an IF instruction to the script. You could, for example, warn users when they type in a forbidden answer.

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 to «state»"

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

If a customer does not type the name of a country before trying to move to the next dialog, the error message appears. An Input Error icon also appears in the interview outline until the user provides an acceptable value for this variable.

In your ERRORTEXT message, it may be helpful to include information for users on how they can meet the conditions needed to complete the dialog and continue with the interview.

Although current and past versions of HotDocs Developer allow the user to click Finish on an Interview Template than contains unanswered required variables or ERRORTEXT variables which have an incorrect answer in them, this behavior will be changed in the future so your templates should not rely on it.