Hi ,
I am trying to add Ajax Behaviour to Radio (in a radioGroup)
RadioGroup has radio_1 and radio_2
radio_1 controls Dropdown_1 (i.e when radio_1 is checked then Dropdown_1 is
enabled and Dropdown_2 is disabled--its all working fine and good)
radio_2 controls Dropdown_2 (i.e when radio_2 is checked then Dropdown_2 is
enabled and Dropdown_1 is disabled --its all working fine and good)
At setup time radio_1 is selected and Dropdown_1 is enabled.
If I submit the form like this then I get the value in the form that I am
submitting.
But, if I change the radio_selected to radio_2 and then submit the form then
the value getting set is NULL.
Question:
How can I make sure that on changing radio appropriate form's model is
updated? What am I missing?
//Here is some code
// Keep the Model of radio group and first radio same. to pre-select it
final RadioGroup group = new RadioGroup("group", this.getModel());
// All the radio Buttons
final Radio radio_1 = new Radio("radio_1", this.getModel());
final Radio radio_2 = new Radio("radio_2",new Model("abc"));
group.add(radio_1);
group.add(radio_2);
radio_1.add(new AjaxEventBehavior("onClick")
{
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target)
{
group.processInput();
dropdpwn_1.setEnabled(true);
dropdpwn_2.setEnabled(false);
if (target != null)
{
target.addComponent(dropdpwn_1);
target.addComponent(dropdpwn_2);
}
}
});
radio_2.add(new AjaxEventBehavior("onClick")
{
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target)
{
group.processInput();
dropdpwn_1.setEnabled(false);
dropdpwn_2.setEnabled(true);
if (target != null)
{
target.addComponent(dropdpwn_1);
target.addComponent(dropdpwn_2);
}
}
});
--
View this message in context:
http://www.nabble.com/RadioGroup%2C-Radio-with-AjaxEventBehavior-not-updating-form-model-tp18720051p18720051.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]