views:

18

answers:

1

I have a Validator on a RadioButtonGroup of 2 Radios. There's a checkbox above the RadioButtonGroup whereby if checkbox.Selected, then the Radios are enabled. So the Validator is required if the checkbox.Selected. So far so good.

The problem is once a radio gets selected, the RadioButtonGroup selectedValue gets set. When I uncheck the checkbox I set the radios to not selected, but the selectedValue on the RadioButtonGroup doesn't get reset -- it hold the previous value. I tried setting it to null but no luck.

Therefore if I check the checkbox again and submit, the Validator see a selectedValue on the RadioButtonGroup. Even though none of the radios are selected, validation passes.

How can I reset the RadioButtonGroup to its initial state when I uncheck the CheckBox?
Thanks.


PS I looked at the underlying code for RadioButtonGroup.selectedValue = null, and what it does is look for a radio in the with the parameter value. If it doesn't find it nothing gets set.