|
From: Anthony E. <me...@an...> - 2002-01-24 15:31:25
|
Greetings all,
Since no one responded back with a negative regarding the change of
FormValidator to an abstract base class I have made the change in the CVS.
Doing this allows FormProc to have validator-specific locale-sensitive error
messages, like this:
<element name="name">
<validator type="expression">
<pattern>\w{1,}</pattern>
<error lang="en">Field required.</error>
</validator>
<message lang="en">Required</message>
</element>
I have also added the concept of shared validators. Shared validators are
defined in the formproc.xml configuration and are then available to all
forms. Thus you could define a validation rule for phone numbers in one
place and have home phone, business phone, and cell phone fields all use the
same validator. Thus, the form configuration would look like this:
<element name="homePhone">
<validator type="shared" name="phone"/>
<message lang="en">Required</message>
</element>
<element name="businessPhone">
<validator type="shared" name="phone"/>
<message lang="en">Required</message>
</element>
<element name="cellPhone">
<validator type="shared" name="phone"/>
<message lang="en">Required</message>
</element>
The addition of this feature should not break any existing configuration
files, but it will allow you to centralize your validation configurations
and improve reuse.
Feedback is, as always, welcome. If you would like to check out via CVS and
build I would be interested in hearing about any problems you may find.
-Anthony
|