In the first part, we saw a glimpse of what the Validator framework can do. But that is just the tip of the iceberg. The driving force behind creation of the Validator framework is reusability. This facet of the framework is but one of the many aspects that can not only reduce the web GUI development time but also enforce standards across all interfaces.
Validators: Into the Deep - Registration Form: Putting it All Together (Page 4 of 4 )
Until now I have simply discussed all of the Validators; now, let's see them in action. For this I will be using a registration form. To keep things simple I will concentrate only on the following fields:
User Name
Name
Email
So let's get started. Up until the <form> element everything is the same as the one illustrated in the first part of this series, which is:
< form-validation> <formset>
<form name=“registrationFormBean”>
: : </form> </formset> </ form-validation>
The first field is the user name. The rules to be applied are mandatory and the minimum length. The minimum length is three characters.
Next comes the Name. Here, apart from the mandatory Validator, the mask Validator will also have to be applied, so that only characters can be entered.
And that brings us to the end of this session of discussion. There are some obvious questions that are left unanswered. These include how to compare and validate the values of two fields such as password, retype password fields, and creating a custom Validator. These will be the topics of the third and last part of this tutorial/discussion series. Until next time.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.