, , , , , , ,

In the Sitecore module WFFM (Web Forms For Marketers) it is very easy to add fields to a form, as well as regular expression validation and error messages. To make a field required is also very easy: just check the ‘Required’ checkbox on the Form Designer or on the WFFM Field content item. However, the error message that comes along with the Required Field Validator is not customizable. At least not out of the box.

If you have a website in any other language than English, this is an immediate problem, because the error message is in English. The standard error message is: “{FieldName} must be filled in.”

You can customize the error message for required fields by navigating to the WFFM Field item that is a child of the instance of the WFFM Form. It is located under Sitecore -> System -> Modules -> Web Forms for Marketers -> Website. Select the required field, make sure that the ‘Required’ box is checked, and look for the field ‘Parameters’ in the section ‘Data’. Add the following tag to the field ‘Parameters’:

<ErrorMessage>'{0}' is a required field.</ErrorMessage>

You can now enter a custom error message, in which the {0} is a placeholder for the WFFM Field Title.