Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
kiran kumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic