You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by bebetu <an...@yahoo.com> on 2007/09/22 22:53:34 UTC

Formless DropDownChoice selected value is null

Hi,
I have a DropDownChoice in a WizardStep component (Wicket 1.3 beta 3) and I
want to read the selected value then update a text label based on selection
as well as disable the "Next" button if the user hasn't made a selection.
First of all I cannot get the selected value when I run the code below, the
selectedChoice variable is always null. 
Secondly, how to ajaxify the "Next" wizard button based on the selection?
What am I doing wrong?

final ValueMap choiceMap = new ValueMap();
final PropertyModel ddcModel = new PropertyModel(choiceMap,
"selectedOption");
final DropDownChoice ddChoice = new DropDownChoice("choiceId", ddcModel,
someOptionList);
ddChoice.add(new AjaxEventBehavior("onchange") {
				@Override
	            protected void onEvent(AjaxRequestTarget target) {
                           Object selectedChoice =
choiceMap.get("selectedOption");

                    }
});

Thanks!
florin
-- 
View this message in context: http://www.nabble.com/Formless-DropDownChoice-selected-value-is-null-tf4502016.html#a12839591
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: Formless DropDownChoice selected value is null

Posted by Johan Compagner <jc...@gmail.com>.
that still doesnt matter, what you use now is just the on change
event, no data will be pushed,for that you need to use the
formcomponentupdatebehavior

On 9/23/07, bebetu <an...@yahoo.com> wrote:
>
> I'm not using a form, it's a simple dropdownChoice in a wizard step.
>
>
> swaroop belur wrote:
> >
> > You should use ajaxformcomponentupdatingbehavior instead of
> > AjaxEventBehavior . I think AjaxEventBehavior just triggers the server
> > side call and does not update model
> >
> > -swaroop
> >
> >
> > On 9/23/07, bebetu <an...@yahoo.com> wrote:
> >>
> >>
> >> Hi,
> >> I have a DropDownChoice in a WizardStep component (Wicket 1.3 beta 3) and
> >> I
> >> want to read the selected value then update a text label based on
> >> selection
> >> as well as disable the "Next" button if the user hasn't made a selection.
> >> First of all I cannot get the selected value when I run the code below,
> >> the
> >> selectedChoice variable is always null.
> >> Secondly, how to ajaxify the "Next" wizard button based on the selection?
> >> What am I doing wrong?
> >>
> >> final ValueMap choiceMap = new ValueMap();
> >> final PropertyModel ddcModel = new PropertyModel(choiceMap,
> >> "selectedOption");
> >> final DropDownChoice ddChoice = new DropDownChoice("choiceId", ddcModel,
> >> someOptionList);
> >> ddChoice.add(new AjaxEventBehavior("onchange") {
> >>                                @Override
> >>                    protected void onEvent(AjaxRequestTarget target) {
> >>                           Object selectedChoice =
> >> choiceMap.get("selectedOption");
> >>
> >>                    }
> >> });
> >>
> >> Thanks!
> >> florin
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Formless-DropDownChoice-selected-value-is-null-tf4502016.html#a12848011
> 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
>
>

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


Re: Formless DropDownChoice selected value is null

Posted by bebetu <an...@yahoo.com>.
I'm not using a form, it's a simple dropdownChoice in a wizard step.


swaroop belur wrote:
> 
> You should use ajaxformcomponentupdatingbehavior instead of
> AjaxEventBehavior . I think AjaxEventBehavior just triggers the server
> side call and does not update model
> 
> -swaroop
> 
> 
> On 9/23/07, bebetu <an...@yahoo.com> wrote:
>>
>>
>> Hi,
>> I have a DropDownChoice in a WizardStep component (Wicket 1.3 beta 3) and
>> I
>> want to read the selected value then update a text label based on
>> selection
>> as well as disable the "Next" button if the user hasn't made a selection.
>> First of all I cannot get the selected value when I run the code below,
>> the
>> selectedChoice variable is always null.
>> Secondly, how to ajaxify the "Next" wizard button based on the selection?
>> What am I doing wrong?
>>
>> final ValueMap choiceMap = new ValueMap();
>> final PropertyModel ddcModel = new PropertyModel(choiceMap,
>> "selectedOption");
>> final DropDownChoice ddChoice = new DropDownChoice("choiceId", ddcModel,
>> someOptionList);
>> ddChoice.add(new AjaxEventBehavior("onchange") {
>>                                @Override
>>                    protected void onEvent(AjaxRequestTarget target) {
>>                           Object selectedChoice =
>> choiceMap.get("selectedOption");
>>
>>                    }
>> });
>>
>> Thanks!
>> florin
>>
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Formless-DropDownChoice-selected-value-is-null-tf4502016.html#a12848011
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: Formless DropDownChoice selected value is null

Posted by Swaroop Belur <sw...@gmail.com>.
You should use ajaxformcomponentupdatingbehavior instead of
AjaxEventBehavior . I think AjaxEventBehavior just triggers the server
side call and does not update model

-swaroop


On 9/23/07, bebetu <an...@yahoo.com> wrote:
>
>
> Hi,
> I have a DropDownChoice in a WizardStep component (Wicket 1.3 beta 3) and
> I
> want to read the selected value then update a text label based on
> selection
> as well as disable the "Next" button if the user hasn't made a selection.
> First of all I cannot get the selected value when I run the code below,
> the
> selectedChoice variable is always null.
> Secondly, how to ajaxify the "Next" wizard button based on the selection?
> What am I doing wrong?
>
> final ValueMap choiceMap = new ValueMap();
> final PropertyModel ddcModel = new PropertyModel(choiceMap,
> "selectedOption");
> final DropDownChoice ddChoice = new DropDownChoice("choiceId", ddcModel,
> someOptionList);
> ddChoice.add(new AjaxEventBehavior("onchange") {
>                                @Override
>                    protected void onEvent(AjaxRequestTarget target) {
>                           Object selectedChoice =
> choiceMap.get("selectedOption");
>
>                    }
> });
>
> Thanks!
> florin
>
>
>