- "required" as language key for a required field
- f.ex. when i use t:validate="required" in a .tml file
- "number-format-exception" for a number field, and integer-format-exception for an integer field
- when an input field attached to an integer property gets a letter, f.ex.
Apache Tapestry - Form Input and Validation:
Customizing Validation Messages
Each validator (such as "required" or "minlength") has a default message used (on the client side and the server side) when the constraint is violated; that is, when the user input is not valid.
The message can be customized by adding an entry to the page's message catalog (or the containing component's message catalog). As with any localized property, this can also go into the application's message catalog.
The first key checked is formId-fieldId-validatorName-message.
If there is not message for that key, a second check is made, for fieldId-validatorName-message.
- formId: the local component id of the Form component
- fieldId: the local component id of the field (TextField, etc.)
- validatorName: the name of the validator, i.e., "required" or "minlength"
If that does not match a message, then the built-in default validation message is used.
http://tapestry.1045711.n5.nabble.com/T5-Overriding-integer-validation-message-td2436931.html#a2436931:
(from the answers)
You should add a prefix consisting of the field id (and optionally the form
id). (Igor)
To generalize messages overrides for all form, you can contribute to ValidationMessagesSource service in your AppModule class with your own
property file. (Christophe)
Trial and error have yielded: [field id]-integer-message (xfile80303)
You should add a prefix consisting of the field id (and optionally the form
id). (Igor)
To generalize messages overrides for all form, you can contribute to ValidationMessagesSource service in your AppModule class with your own
property file. (Christophe)
Trial and error have yielded: [field id]-integer-message (xfile80303)
Blogged with the Flock Browser
No comments:
Post a Comment