This list of features already looks quite impressive for a default configuration, but
there are more miracles to see. Purely for the purpose of demonstration, enter some
non-numeric value, like abc, into the Id field and click on the Create/Update button.
You will see something similar to this:
???
???
??? ???
???
???
Advanced Components
[ 142 ]
Which means that in addition to everything else, BeanEditForm comes with a
pre-configured system of user input validation, and applies reasonable restrictions to
its fields, like it prevents entering a non-integer value for an integer property.
User input validation is the topic for the next chapter, but you can already see that
without any efforts from our side, the validation system of Tapestry 5 does quite a
lot??”it changes the style of the field in error, its label and adds an error marker, and
also displays an appropriate error message at the top of the form. In Chapter 7 you
will see that it can even display error messages in many different languages! Well,
the error message is somewhat misplaced at the moment, but we'll deal with this
problem later.
Do you still remember that to obtain all this wealth of functionality, all we had to do
is to insert a short line of markup into the page template? Here it is again:
Tweaking BeanEditForm
There are a few parameters that we could use to tweak the component.
Pages:
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192