Sections in this category

Validation and Format Validation

If you are requiring a response to a question in a custom form, you must create a validation message that will appear when a person fails to answer the question. You can also create format validation to make sure the response is formatted correctly. This article will address both types of validation on the question record. It is impossible to cover all possible Regular Expression formats, but a couple common ones are shared below along with simple steps to search for others.

Required Yes or No

This field defaults to yes in CRM, but can be switched to No if answering the question is optional. On the portal if this is set to yes, you will just see the question name on the form. If it is optional you will see (optional) next to the question name.

Validation Message for Required Questions

If the question Required = Yes you must prepare a message to display if an answer is not given and the respondent tries to move on. To remove the validation message the respondent must answer the question.

Format (Regular Expression)

Format (Regular Expression)

This is where you can specify the format in which data should be entered. Note that for Currency, Decimal, Floating Point, and Whole Number fields this is already set up for you though you do not see it in CRM, The portal displays the format validation message by default if the information is not entered correctly. (Decimal and Currency only allows for two digits after the decimal point). To remove the error message, the respondent will need to correct the data and the message should disappear.

However, just because the defaults above are in the system does not mean that you cannot customize the format to fit your specific needs. If you do add format expression to any of these numeric fields then your customizations will override the default.

Where to find Regular Expression

Where to find Regular Expression

Regular Expression is not as simple as saying .123 if you want three decimal points. It requires some coding. Don't fear, many common requirements are easily found by a Google search. For example, if I want to allow for 3 decimal points on a decimal field instead of 2. I can Search for "regular expression for 3 decimal points" and then find resources with suggestions. Of course if you are familiar with writing regular expressions you can certainly do so, but most users will likely find the internet a valuable time saving resource.

Note that you'll want to make sure your expression actually works the way you need it to by testing it.

 

Format Validation Message

Format Validation Message

If you set your own regular expression you will need to also create the validation message that appears on the screen if the correct format is not followed. Usually this message helps explain what is required.

Format Validation for Date Fields

If you select the date type you cannot override the default MM/DD/YYYY format. Well you can try, but it will be impossible to enter valid data and no one will be able to move on through the process. However, if you want to collect dates in a different format you can create a Single line of Text field and use a regular expression.

Date format yyyy/mm/dd

Format Regular Expression for Single Line and Multiple Lines of Text

If you are looking for names or a description you don't need to set a format as this information can be valid in multiple formats and trying to limit can prove frustrating to you and respondents. However, there is some data you may want to gather that you would like to be entered in the same format to make reporting more readable later. Also some data must be in a specific format if you plan to map it to CRM.

Phone number is a common Single Line of Text question with a format regular expression