Format the Variable

You can cause an answer to be formatted a certain way in an assembled document—even if the user types the answer using a different format. For example, a number can be merged as ONE HUNDRED DOLLARS in the assembled document, even if the user types 100. (See How Example Formats are Interpreted.)

You can assign the format either when you insert the variable field or when you create the variable component. Specifically, if you assign a format at the Variable Field dialog box, the format applies to that specific instance of the variable only—the format is a property of the field. However, if you assign a format to the component, that format is used each time the variable is inserted into the template. The format becomes a property of the component.

When you insert a new variable in a template (without replacing any template text), you can specify which format you want HotDocs to use for that instance. However, when you create a variable by replacing existing template text (see Insert a Variable Field in a Text Template), HotDocs looks at the text you have selected and attempts to suggest a field-specific format based on what it sees. For example, if you select the template text, 14 November 1973 and then create a Date variable, HotDocs suggests a field-specific format of 3 June 1990. This format will be applied to this instance of the variable only.

Finally, if users' answers shouldn't break across lines in the document, you can force the answer to be non-breaking. You do this by selecting the Non-breaking property next to the Format drop-down list at either the Component Editor or at the Variable Field dialog box.

To assign a field-specific format to a variable

  1. At the template, place your cursor inside a variable field and click the Variable Field button. The Variable Field dialog box appears.
  2. If it's selected, clear Use default. The format options become available.
  3. Click the Format drop-down button and select an appropriate format.
  4. Optionally, select Non-breaking. This keeps the answer from breaking across lines in the document. (You can assign this property to a variable field even if you do not assign a specific format.)
  5. Click OK.

When you assign a field-specific format to the variable, the example format is merged with the variable name in the field.

To assign a default format to a variable

  1. At the template, place your cursor inside a variable field and click the Edit Component button. The Variable Editor appears.
  2. Click the Default format drop-down button and select an example format.
  3. Optionally, select Non-breaking to keep the answer from breaking across lines in the document. (You can assign this property to a variable field even if you do not assign a specific format.)
  4. Click OK.

Now, when you insert this variable in other places in the template, the format you have specified will be used. (You can, of course, override this by assigning a field-specific format.)

When you view the Variable Field dialog box, the default example format you have selected appears grayed in the Format field, and Use default is selected. If you clear this check box, the default format is suggested as the field-specific format. It also becomes a property of the field.

The Use defaults option at a Variable Field dialog box controls all field properties of a variable. (Field properties include answer formats, Multiple Choice merge text, and field formats.) This means that you cannot assign a field-specific property to a field and then assign a default property to the variable component. If you choose one type of property, all other properties must be the same type.

You can create your own formats by typing an example in the Format field. Follow the format of the existing examples—for example, use a variation on the number nine for number examples, and use a variation on the date June 3, 1990 for date examples.