You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Robert Gründler <ro...@dubture.com> on 2010/04/09 14:15:10 UTC
AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Hi all,
i'm trying to use the AjaxFormChoiceComponentUpdatingBehavior on a RadioGroup component,
unfortunately, no ajax request is triggered when the RadioBoxes are clicked.
Here's the code i'm using right now:
Form form = new Form("addressform");
String[] choices = new String[]{ "Wicket", "Spring", "DB4O" };
group = new RadioGroup("group", new Model<String>());
ListView<String> deliveryAddresses = new ListView<String>("deliveryaddresses", Arrays.asList(choices)) {
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Radio<String>("group-choice", new Model<String>()));
}
};
group.setOutputMarkupId(true);
group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
System.out.println("on change");
}
});
group.add(deliveryAddresses);
form.add(group);
add(form);
/* markup */
<wicket:panel>
<form wicket:id="addressform">
<table>
<span wicket:id="group">
<tr wicket:id="deliveryaddresses">
<td><input type="radio" wicket:id="group-choice"/></td>
</tr>
</span>
</table>
</form>
</wicket:panel>
Has anyone an idea what i might be missing ?
thanks!
-robert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by Per Newgro <pe...@gmx.ch>.
Please check the markup. It's invalid and causes the problems.
Try this:
<wicket:panel>
<form wicket:id="addressform">
<table wicket:id="group">
<tr wicket:id="deliveryaddresses">
<td><input type="radio" wicket:id="group-choice"/></td>
</tr>
</table>
</form>
</wicket:panel>
The span is not allowed there.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by Robert Gründler <ro...@dubture.com>.
>> "Wicket", "Spring", "DB4O"
> You want this to be set?
no, i'm trying to fire an ajax request when a radiobutton is pressed by the user, to handle
the selected item on the server.
The radiogroup is inside a WizardStep, and i need to update the Wizards model using ajax
to display the content's of the next step accordingly.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by Per Newgro <pe...@gmx.ch>.
Am 09.04.2010 14:50, schrieb Thies Edeling:
> and how to wickettest an AjaxFormChoiceComponentUpdatingBehavior on a
> RadioGroup? Setting the value in a test is no problem but it never
> executes the behavior
>
>
FormTester.select(componentId, value);
FormTester.submit();
WicketTester.executeAjaxEvent(componentId, eventName);
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by Thies Edeling <te...@gmail.com>.
and how to wickettest an AjaxFormChoiceComponentUpdatingBehavior on a
RadioGroup? Setting the value in a test is no problem but it never
executes the behavior
On 04/09/2010 02:45 PM, Per Newgro wrote:
> Am 09.04.2010 14:15, schrieb Robert Gründler:
>> "Wicket", "Spring", "DB4O"
> You want this to be set?
>
> try
>
> @Override
> protected void populateItem(ListItem<String> item) {
> item.add(new Radio<String>("group-choice", item.getModel()));
> }
>
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by Per Newgro <pe...@gmx.ch>.
Am 09.04.2010 14:15, schrieb Robert Gründler:
> "Wicket", "Spring", "DB4O"
You want this to be set?
try
@Override
protected void populateItem(ListItem<String> item) {
item.add(new Radio<String>("group-choice", item.getModel()));
}
Cheers
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: AjaxFormChoiceComponentUpdatingBehavior on RadioGroup
Posted by "ildella@gmail.com" <il...@gmail.com>.
Did you succeed in making AjaxFormChoiceComponentUpdatingBehavior work
on a RadioGroup?
I can't make it work, wicket 1.4.14
I need to save the selected value to my model object when a Radio in
the RadioGroup is selected.
This becaus every time an option is selected in the form, the whole
form is reloaded to see if some new condition is met and something new
becomes visible/enabled.
So in reloading the model, if I did not persist the values via Ajax
before, I lost user selection.
I am succeding in doing this with
AjaxFormChoiceComponentUpdatingBehavior on a RadioChoice but can't
figure out how to get the ajax callback on a Radio selection in a
RadioGroup.
any hint?
2010/4/9 Robert Gründler <ro...@dubture.com>:
> Hi all,
>
> i'm trying to use the AjaxFormChoiceComponentUpdatingBehavior on a RadioGroup component,
> unfortunately, no ajax request is triggered when the RadioBoxes are clicked.
>
> Here's the code i'm using right now:
>
> Form form = new Form("addressform");
> String[] choices = new String[]{ "Wicket", "Spring", "DB4O" };
> group = new RadioGroup("group", new Model<String>());
> ListView<String> deliveryAddresses = new ListView<String>("deliveryaddresses", Arrays.asList(choices)) {
> @Override
> protected void populateItem(ListItem<String> item) {
> item.add(new Radio<String>("group-choice", new Model<String>()));
> }
> };
>
> group.setOutputMarkupId(true);
> group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> System.out.println("on change");
> }
> });
> group.add(deliveryAddresses);
> form.add(group);
> add(form);
>
> /* markup */
>
> <wicket:panel>
> <form wicket:id="addressform">
> <table>
> <span wicket:id="group">
> <tr wicket:id="deliveryaddresses">
> <td><input type="radio" wicket:id="group-choice"/></td>
> </tr>
> </span>
> </table>
> </form>
> </wicket:panel>
>
>
> Has anyone an idea what i might be missing ?
>
>
> thanks!
>
> -robert
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Daniele Dellafiore
http://danieledellafiore.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org