Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

validation for multiple dependency arrays

 
Raymond Holguin
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

ACTION FORM


JSP



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

VALIDATION.XML


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.


VALIDATOR


can someone please help me with this??
thanks
-Ray
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!