aspose file tools*
The moose likes Struts and the fly likes how can  use conditional validations on predefined validations in struts1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how can  use conditional validations on predefined validations in struts1.2" Watch "how can  use conditional validations on predefined validations in struts1.2" New topic
Author

how can use conditional validations on predefined validations in struts1.2

kiran kumar
Greenhorn

Joined: Feb 07, 2005
Posts: 29
hi
in struts-config.xml

i am using DynavalidatorForm.

form fields are suppose assume field1 and field2.
i need to validate integer,required for both fields.
but my requirement is if field1 is selected and typed then need not validate field2.
when i am using validwhen,integer and required for field2
even thought validwhen is working,required,integer validations are validating on field2.
i need not validate required,integer validations when field1 is selected and
typed integer.
any solutions....
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
instead of having 'required' for field2, use validwhen. in the end, i think the validation rules for both field1 and field2 should be EXACTLY the same (e.g neither should have the 'required' dependency).

the 'integer' may cause some problem as int is default to '0'. you may want to consider using 'mask' ( ^[0-9]+$ ) to check for numeric only which is the same as 'integer'.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can use conditional validations on predefined validations in struts1.2
 
Similar Threads
JSF - How can I get hyperlink in error messages?
declaritive validation - validwhen
Struts 1.3 Configuring different set of validations for the same ActionForm
valid when
Incompatibility problems when altering serialized objects