File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes validation for multiple dependency arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation for multiple dependency arrays" Watch "validation for multiple dependency arrays" New topic

validation for multiple dependency arrays

Raymond Holguin
Ranch Hand

Joined: Aug 11, 2009
Posts: 72
To keep it simple I have 2 fields in my form (First + Last name) user can enter multiple names and both fields are required if they enter multiple names.

So i have my basic setup



now what i want to do is make sure that if they type something into fname[2], lname[2] also has a value in it. This is where my problem starts. I am using custom validator methods so in my validation.xml i have something like this


basically what i want to do is when i send the fname property to my validateNames method, i want to know which index i am current validating (fname[0] or fname[1] .....). that way i can check teh correpsonding index in the lname field to see if its NULL or not and validate accordingly. maybe using the <var> tag is not what i want to do and there is a way inside the validating method to pull that index out im not sure.


can someone please help me with this??
I agree. Here's the link:
subject: validation for multiple dependency arrays
Similar Threads
Apache Commons Validation
Cannot load a validator resource
struts 1.3,Validator forpassword field
validation error
validation: how to make int and double validations work ?