I am hiding some fields based on some condition, i.e. in UI they won't be visible , but clicking on submit button ,struts is validating these hidden fields ..
Is there a way to tell struts not to validate fields which are hidden ... i.,e validate these fields only when they are visible on UI.
I am using struts 1.2 framework.
Set a property on your form when you trigger these conditions and then check for that in your validator:
if(!form.isSkipValidation()){
//Hear you can write your Validation code..
}
In javascript you can set this property with a hidden input field:
<input type="hidden" name="skipValidation" value="false"/>
hope this is helpful...