You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by radovan <ra...@seznam.cz> on 2008/10/07 12:35:43 UTC

RadioChoice with Ajax

Hallo, I have this code:

    private static final List<String> Orders = Arrays.asList(new String[] {
"asc", "desc" });
    private final IModel<String> model = new Model<String>(Orders.get(0));

        RadioChoice radioChoice = new RadioChoice("orders", model, Orders);
        radioChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                System.out.println(model);
            }
        });

I expected, that model contains selected choice, but this print "null". How
I can get value of selected choice? - with Ajax (no submit button)
-- 
View this message in context: http://www.nabble.com/RadioChoice-with-Ajax-tp19855494p19855494.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: RadioChoice with Ajax

Posted by radovan <ra...@seznam.cz>.
it works, thank you very much!!


Michael Sparer wrote:
> 
> just a guess:
> from the AjaxFormComopnentUpdatingBehavior's javadoc:
> "NOTE: This behavior does not work on Choices or Groups use the
> AjaxFormChoiceComponentUpdatingBehavior for that. "
> 
> regards,
> Michael
> 
> 
> radovan wrote:
>> 
>> Hallo, I have this code:
>> 
>>     private static final List<String> Orders = Arrays.asList(new String[]
>> { "asc", "desc" });
>>     private final IModel<String> model = new
>> Model<String>(Orders.get(0));
>> 
>>         RadioChoice radioChoice = new RadioChoice("orders", model,
>> Orders);
>>         radioChoice.add(new AjaxFormComponentUpdatingBehavior("onchange")
>> {
>>             private static final long serialVersionUID = 1L;
>> 
>>             @Override
>>             protected void onUpdate(AjaxRequestTarget target) {
>>                 System.out.println(model);
>>             }
>>         });
>> 
>> I expected, that model contains selected choice, but this print "null".
>> How I can get value of selected choice? - with Ajax (no submit button)
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/RadioChoice-with-Ajax-tp19855494p19856526.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: RadioChoice with Ajax

Posted by Michael Sparer <mi...@gmx.at>.
just a guess:
from the AjaxFormComopnentUpdatingBehavior's javadoc:
"NOTE: This behavior does not work on Choices or Groups use the
AjaxFormChoiceComponentUpdatingBehavior for that. "

regards,
Michael


radovan wrote:
> 
> Hallo, I have this code:
> 
>     private static final List<String> Orders = Arrays.asList(new String[]
> { "asc", "desc" });
>     private final IModel<String> model = new Model<String>(Orders.get(0));
> 
>         RadioChoice radioChoice = new RadioChoice("orders", model,
> Orders);
>         radioChoice.add(new AjaxFormComponentUpdatingBehavior("onchange")
> {
>             private static final long serialVersionUID = 1L;
> 
>             @Override
>             protected void onUpdate(AjaxRequestTarget target) {
>                 System.out.println(model);
>             }
>         });
> 
> I expected, that model contains selected choice, but this print "null".
> How I can get value of selected choice? - with Ajax (no submit button)
> 


-----
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: http://www.nabble.com/RadioChoice-with-Ajax-tp19855494p19856377.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org