sebastian schrieb:
Hi, the problem i have is that I have a group of radio buttons
associated with a hidden field like this:

<input type="hidden" name="data[User][gender]" value=""
id="UserGender_" />
<input type="radio" name="data[User][gender]" id="UserGenderF"
value="f"  />
<label for="UserGenderF">Female</label>
<input type="radio" name="data[User][gender]" id="UserGenderM"
value="m"  />
<label for="UserGenderM">Male</label>

and I have the following validation rule for the element:

"data[User][gender]":"required"

the validation doesn't work , it always shows an error whether the
radio buttons are selected or not.

Please help.
The required-method doesn't support mixed types. In your setup, only the hidden field is validated, which is always invalid.

You could implement a custom required-method for this case. Take a look at the current required-implementation for reference validating the group of radio buttons.

Jörn

Reply via email to