We have seen numerous examples on how to add your own validation code to your surveys. This part of the documentation looks into how you can add your own texts to the standard answer checks that are provided in Forsta Plus.
The following standard answer checks (validations) are available in Forsta Plus:
- Answer required checks - All questions (except for ordinary multi questions without an exclusive item ("None of the above")) are by default required. You can set a question to be "Not required" in the properties of the question, or you can turn off the checking for all questions by deselecting "Answer required checks" when generating WI.
- Exclusivity tests - An "exclusive item" in the answer list of a multi question is an answer alternative with the "single punch" property set. (Typically a "None of the above" or "Don't know" answer alternative.) This means that the answer alternative cannot be answered in combination with any of the other items. The exclusivity check makes sure that the question has at least one answer, and that no exclusive item is selected in combination with other answers. This checking can be turned off by deselecting "Exclusivity tests" when generating WI.
- Other-specify checking - When the "other" property is set for an item in an answer list, a text box is included next to that item. The "other-specify" checking makes sure that there is a correspondence so that the text box has an answer only if that answer alternative is selected and visa versa. It can be turned off globally by deselecting "Other-specify checking" when generating WI.
- Rank order tests - For a ranking question or a grid question with the "ordered" property set, the system checks that the answers constitute a set of consecutive integers starting at 1, and that all items have a rank. This default checking can be turned off globally by deselecting "Rank order tests".
- Answer size tests for fixed-width fields - If a field width is defined for a question, the system checks that the respondent's answer is within the limit. This cannot be turned off globally, because the database is set up according to the field width definitions, so the database cannot accept answers above this limit.
- Numeric validation - For numeric and numeric list questions, the system checks that the answer consists of the symbols 0 to 9 only, and is within the limits defined in total digits, decimal places as well as lower and upper limit. This validation cannot be turned off globally because the database is set up according to these settings and cannot accept non-numeric answers that do not correspond to these settings.
All of these types of validation have their own error messages provided in Forsta Plus. These error messages are provided in a number of languages, but are the same for all users of an installation. They can be changed globally on a Forsta Plus server installation, but not for individual surveys.
If you want something other than the standard error messages, you must add code in the validation code field of the question where the validation applies. This part of the documentation explains a number of functions that make it easier to build customized error messages for the default answer checks.