SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 196 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"


Identify the field that is erroneous and mark it in some way.
If possible, display the erroneous value, and maybe even explain why exactly
it is wrong.
Let's see how Tapestry 5, being a highly efficient and user-friendly framework,
handles these issues.
Adding Validation to Components
Have a look at the Start page of the running Celebrity Collector. There is a login
form that expects the user to enter some values into its two fields. But, what if the
user didn't enter anything and still clicked on the Log In button? Currently, the
application will decide that the credentials are wrong and the user will be redirected
to the Registration page, and receive an invitation to register. This logic does make
some sense; but, it isn't the best line of action, as the button might have been pressed
by mistake.
??? ??? ???
User Input Validation
[ 158 ]
These two fields, User Name and Password, are actually mandatory, and if no value
was entered into them, then it should be considered an error. All we need to do for
this is to add a required validator to every field, as seen in the following code:



Label for the first text box
:


t:label="User Name" t:validate="required"/>





The second label
:


t:type="PasswordField" t:validate="required"/>


Just one additional attribute for each component, and let's see how this works now.


Pages:
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6