<html:javascript> tag and validator plugins
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jerome_Iffrig
Posted On:   Friday, August 9, 2002 02:16 AM

As far as I understand, the tag can be used to validate entries (via javascript generated from a validatorXX.xml file). Here is the deal: In a form, I have 3 independent fields asking the user to enter his date of birth (respectively [day], [month] and [year] fields) I would like to use the and a validator XML file to check the consistance of THE GROUP [day][month][year] rather than checking the validity of each field individualy (as it is the case in the nightly built validator example). e.g. I want to check that if [month] = april, the user has not specified day = 31 (as april only counts 30 days), check that the year of birth is not something like 2020 or some other silly value - See the problem? The v   More>>

As far as I understand, the tag can be used to validate entries (via javascript generated from a validatorXX.xml file).

Here is the deal:

In a form, I have 3 independent fields asking the user to enter his date of birth (respectively [day], [month] and [year] fields)

I would like to use the and a validator XML file to check the consistance of THE GROUP [day][month][year] rather than checking the validity of each field individualy (as it is the case in the nightly built validator example).


e.g. I want to check that if [month] = april, the user has not specified day = 31 (as april only counts 30 days), check that the year of birth is not something like 2020 or some other silly value - See the problem? The validation implies checking on fields depending on other fields - And I would like to centralize this kind of tests in one validator XML file.


Thanks

   <<Less

Re: &lt;html:javascript&gt; tag and validator plugins

Posted By:   Anonymous  
Posted On:   Sunday, August 11, 2002 09:37 AM

Check out the following example written by the author of the Validation framework:

http://home.earthlink.net/~dwinterfeldt/overview.html#creatingValidators.

The example shows how to write a custom validator to
compare 2 fields (e.g. passwords) and make sure they're the same.

You can use the same technique to handle other inter-dependencies between fields.

Re: &lt;html:javascript&gt; tag and validator plugins

Posted By:   Ziad_Mannan  
Posted On:   Friday, August 9, 2002 08:27 AM

The validator has a rule for checking dates, its called 'date' (surprise, surprise!!), but i think the date has to go on one field for it to work. so you would have to have a text box where someone would type in a date like "1/1/2002".


I've not tried this myself but i'm guessing the validator wont be able to do it over three fields like the way u r trying to do it


hth


ziad

About | Sitemap | Contact