If there is an Errors component in the form, it will automatically display
error messages for all the errors in ValidationTracker. The error messages
for standard validators are provided by Tapestry while the name of the
component to be mentioned in the message is taken from its label.
A lot of very useful functionality comes with the framework and works for us "out of
the box", without any configuration or set-up!
Tapestry comes with a set of validators that should be sufficient for most needs. Let's
have a more detailed look at how to use them.
???
???
???
???
???
Chapter 6
[ 161 ]
Validators
The following validators come with the current distribution of Tapestry 5:
Required??”checks if the value of the validated component is not null or an
empty string.
MinLength??”checks if the string (the value of the validated component) is
not shorter than the specified length. You will see how to pass the length
parameter to this validator shortly.
MaxLength??”same as above, but checks if the string is not too long.
Min??”ensures that the numeric value of the validated component is not less
than the specified value, passed to the validator as a parameter.
Max??”as above, but ensures that the value does not exceed the specified limit.
Pages:
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211