Quick Tip: Limit Response Length

Disclaimer: As of June 2018, Form Builder 5.0 is the default version of the FormAssembly Form Builder. Visit the release blog post to learn about the Form Builder 5.0 improvements.

<color=”red”>Update: Form Builder 4 simplifies limiting the characters in a text field.
While more information is often better than less, sometimes you may want or need to limit the length of a respondent’s answer1. You can use a simple formula with the Form Builder’s built-in validation routine to set a maximum number of characters for a text entry field and alert the respondent when their answer is too long.

Set Regular Expression Validation

If you haven’t already done so, create the field whose length you would like to limit. Then, in the Properties panel, select “custom (regular expression)” from the “Format” dropdown. In the Regular Expression text area, type:
Change the “5” to the number of characters you would like to limit the answer2.
Regex Char Limit

Don’t Forget the Hint

As with all validation on FormAssembly, this only runs when the respondent clicks the submit button. Until then, he or she won’t know that there is a character limit unless you specify it on your form. A hint is helpful in this instance.
You can also use the Custom Validation Message to remind respondents about the character limit.
See also a discussion in our user forum on using regular expressions to impose character limits.
Got a Quick Tip of your own? Using a FormAssembly form in a unique way? Let us know! Leave a comment, tell us via Twitter, or contact us.

1There is no technical reason that this would be necessary. FormAssembly does not limit the amount of data that can be stored in a response.
2The esoteric looking formula can be explained like this:
^ = start counting at the beginning of the text
$ = stop counting at the end of the text.
[\s\S] = count any type of characters (letters, numbers, etc.. including line breaks).  An alternative could be  ‘.’ which would match all characters but line breaks.
{0,5} = count between 0 and 5 characters.

Don’t just collect data — leverage it.