Hi,

I've got a form with a required radiochoice to select among some options.
I've also got a yes/no radiochoice that selects a given option on rc1 and
disables it when 'yes' is selected. When 'no' is selected, rc1 is set to
enabled and its model object is cleared.

The enabling/disabling of rc1 and its modelobject set is done in the
onUpdate() method of an AjaxFormChoiceComponentUpdatingBehavior on the
yes/no radiochoice.

It's working fine, except in the following situation: 'no' is selected and
rc1 has no value set. Then the required validation prevents the form
submission. After that, if I select 'yes' on the yes/no radiochoice, it
enables rc1 and sets its model object successfully, but, to my surprise, the
<input type="radio"> has no value selected when rendering the HTML.

After debbuging through rc1#onComponentTagBody(), I've found that getValue()
returns null, because rawInput is null (and not NO_RAW_INPUT), that's why
there's no radio selected. I suspect rawInput is null because of last
submitting rc1 with no value selected (when the required validation fails).
I managed to get around this by calling rc1.clearInput() on the ajax
behavior.

Just want to know if i'm right about these thoughts, because I feel
something wrong here, and if calling clearInput() is a good way of dealing
with this.

Thank you for your feedback!
Xavier

Reply via email to