Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pushkar,

[EMAIL PROTECTED] wrote:
Can you please tell me whether I can validate a set of radio buttons so that
atleast one of them is checked, using the struts validation.xml? Is there a
pre-defined validator method (like required) defined for that or will I have
to write a custom validator method?

You want to look into using the "validwhen" validator, which requires
some reading. Check out this page
(http://struts.apache.org/1.3.5/faqs/validator.html) and read the
section titled "Designing Complex Validations with validwhen"

You'll want a field set up with a "validwhen" test like:

((*this* != null) or (otherField != null)) or (anotherField != null) ...

Actually, assuming it's a radion button group that maps to a single property, you probably just need the 'required' validation to ensure that property has a value. You should only need 'validwhen' if there are multiple properties involved, or if you need to express complex constraints on a single property.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to