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 Struts2 Validation - skip validation for certain fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Validation - skip validation for certain fields" Watch "Struts2 Validation - skip validation for certain fields" New topic
Author

Struts2 Validation - skip validation for certain fields

Anand Krishnanandam
Greenhorn

Joined: May 23, 2006
Posts: 25
Hi,
I want to validate couple of fields based on the checkBox value.
(checkbox doesn't need validation though)
ex:

if(checkBox.value=false){
validate
name
address
city
graduate school
}else if (checkBox.value=true)
{
skip validation for graduate school
}




any example code or link would be very helpful
Thanks,
Anand
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

For a simple case like this where there's only one validation that depends on the checkbox value it'd be easy enough to use the expression validator, which accepts arbitrary expressions.

Anything substantially more complicated than that and I usually end up pushing the validation into Java by using a validate() method.
Anand Krishnanandam
Greenhorn

Joined: May 23, 2006
Posts: 25
something like ?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Validation - skip validation for certain fields