Is there any way to override the text “This field is required!”?
(for example, if I want to display it in a different language)
I can use a custom validator and set required to false but then the * goes away.
I would also like to do the same with the other standard validators if possible, like “Invalid e-mail address!”, but these at least could be rewritten as custom…
For posterity: another technique to do this is to use a validator_calc which will use your custom errorMsg. You can then use other techniques, such as an errorMsg_calc to set the message conditionally (i.e. for different languages)
This is helpful if you want a simple validation type like required but need a custom message.
This validator_calc checks to see if the field is required in the data model (model.config.required.nameFirst). If required, it checks to ensure the field has a value (length>0). If not required, it always validates.
Note that this will cause JS errors if you do not define the key in your data model. Meaning (for the example above), the key form.shipping.nameFirst must exist in the data model, otherwise you will get a JS typeError because lenght can’t be evaluated on a key that doesn’t exist. This can break page responsiveness.