wood burning stoves 2.0*
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
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>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how can use conditional validations on predefined validations in struts1.2
 
Similar Threads
declaritive validation - validwhen
valid when
Struts 1.3 Configuring different set of validations for the same ActionForm
Incompatibility problems when altering serialized objects
JSF - How can I get hyperlink in error messages?