Custom validation messages



ViewsFlash provides rich facilities for checking questionnaire fields for correct values and for displaying appropriate error messages. The Style used when the question is created, such as Number, includes characteristics of what can be entered into the field. A question can also be flagged as Required. Each of these error conditions is reported using a standard error message. These messages can be redefined for all questions or tailored for specific questions. For example, one required question can use the message "Zip code required" and another required question can use the message "Please enter an amount", while they both share a message "Enter only numbers" when a non-numeric value is entered.

Validation error messages are presented when the page is sent by pressing the Next or Submit button on a questionnaire. By default, each message is displayed as a Javascript alert box, and the cursor is placed on the field in error when the alert is cleared, as shown here:


The General page includes a setting for [x] Show validation messages inline. With this setting, each message is displayed next to the question in error, and a listing of those questions is displayed at the top of the page, as shown here:

inline messages

Specifying messages

To customize messages, enter in the Customized messages box one line for each message. Each line consists of a message code, an equal sign, and the message.

To change a default message, enter the message code and the message. Examples:
To change the default message "Please correct the following errors", enter:
correcterrors=Correct these errors
To change "Question must be answered", enter, on a different line:
presence=Answer this question
To change the text of the Next button:

It is also possible to change the validation messages for a specific question. To adapt the "Question must be answered" message to questions named "name", "address" and "zip", enter:
presence-name=Fill in name
presence-address=Provide address
presence-zip=Enter ZIP code

The Show messages link displays a list of all the default messages. You can cut and paste lines from there.

When translating a questionnaire, Show messages displays messages in the language of the questionnaire, while the Show messages in English link displays the messages in English.
Cut and paste the entire text area to the Customized messages box and translate the messages there.


Next: Question Styles