Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validating certain fields while leaving others out

 
Andr� Cedik
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I've searched for this but couldn't find a satisfying answer. Maybe I'm even thinking too complex and the answer is pretty simple. Anyway - I've got the following problem.

I've got a form with 6 fields (strings and integers - but that's not the point). The first 3 and the last 3 depend on each other. What I mean by that is that if either field 1,2 or 3 has a value the other 2 got to have a value too, while the other 3 (4,5 and 6) don't. Or you can turn it around and write something into field 4,5 or 6 and the other 2 have to be filled in, while 1,2 and 3 don't have to be filled.

Just so you know - I'm using XML-field-validators in Struts 2. I thought something like this might work, but didn't.


Maybe anyone of you has got an answer to that.
Thanks in advance.
 
Rama Krishna Ghanta
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I dont think this can be achieved using the Validator Framework..I was using the validator framework from past 3years...I had a similar requirement some time back and I used Javascript validation for that..You better go for Javascript validation...

Regards,
Rama Krishna.
 
Andr� Cedik
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks - that's what I ended up with.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic