File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Validating certain fields while leaving others out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validating certain fields while leaving others out" Watch "Validating certain fields while leaving others out" New topic
Author

Validating certain fields while leaving others out

Andr� Cedik
Greenhorn

Joined: Mar 30, 2008
Posts: 8
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

Joined: Nov 20, 2006
Posts: 59
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.


Ram...
Andr� Cedik
Greenhorn

Joined: Mar 30, 2008
Posts: 8
Thanks - that's what I ended up with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Validating certain fields while leaving others out
 
Similar Threads
Init / Context Parameters revisted
Struts 2 Validation
Pop up error while using validation in struts2.0
Struts Validator FrameWork = JavaScript Error
Passing a string array in var-value