my dog learned polymorphism
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 81
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
It's not a secret anymore!