A text variable is a type of variable that represents an unknown text value. For example, if you want to ask a template user for their first name you would create a text variable in your template to capture that specific item of data.
In this topic ShowHide
In HotDocs, a text variable is a component that represents unknown text content in your template (i.e. a text value, such as a client name or business address, yet to be entered by the template user or computed by a computation). You can create text variables using the HotDocs Field Editor or Component Studio and text variables are typically:
Like other components, text variables have properties that you can set to define how they perform in an interview and how HotDocs processes the text variable in an assembled document. In fact, text variables have a number of unique properties, which you can review below.
Among others, text variables enable you to accomplish the following common tasks:
When you create a template from an existing document, the existing document usually contains placeholder text for the text that is unknown. To enable template users to provide the unknown text, you:
When creating a text variable, you can set properties that define how to gather an unknown text value from a template user, how HotDocs stores that text value as an answer, and how to format that answer when assembling a document. For example, you start by setting the name property for the text variable, which is used to identify the text variable throughout Author and in the answer file. You can set the Prompt property to provide instructive text (as opposed to the text variable name) to help a template user answer a question during the interview. You can set the Default format property to define the pattern that HotDocs uses to format the template user's answer in the assembled document (such as all caps). Lastly, you can then group related text (and other) variables into dialogs to improve the usability and flow of an interview.
Once you have created the text variable and set all of the properties you need, you can use the test feature to ensure the variable will behave as you desire when the document is assembled.
Text variables have a unique feature—known as answer suggestions—that enable you to help a template user more quickly answer an interview question by presenting a list of suggested text values that the template user can (but is not required) to choose from. For example, assume you want to ask the template user what one person's relationship is to another. Using answer suggestions, you can provide them a list of likely answers to choose from (mother, father, son, etc.) but also provide them a way to type their own answer (in case the user needs to enter a value outside of the suggested ones). You can style answer suggestions, and the way that the answer control is presented in the interview, in one of two following ways:
You can access the answer suggestions feature in the text variable's component editor. From the editor, you can perform the following tasks necessary to use answer suggestions:
To learn more about the options you have for displaying suggestions to your template users, you can review the settings documented in the Text Variable Editor.
Like all variables, text variables have properties you can use to edit how the text variable appears in an interview, how the text variable is processed during assembly, etc. In addition to the properties common to all variables, text variables have the following unique properties:
To better understand when to use a text variable (as opposed to the other types of variables), consider the following:
When working with text variables, there are times when you may want to control how a template user's answer to an interview question is displayed in an assembled document. For example, you may want names entered without capitalization (e.g. bob smith) to appear in the assembled document with capitalization (e.g. Bob Smith). HotDocs enables you to make such modifications to answers based on text variables using text formats. To assist you in using text formats, HotDocs provides a set of commonly used text formats (such as formats that enable you to use all caps, all lowercase, and more) when you install Author.
You can either format a single instance of the placeholder field that references the variable, or you can format every placeholder field that references that variable throughout the template. You can also create your own custom format, should you need a format not included in the commonly used formats.
For more information on formats, you can read the formats overview and the document for more information.
Among others, the following reference topics may relate to this conceptual area: