You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Josh Kamau <jo...@gmail.com> on 2012/06/26 08:56:05 UTC

Calling OnChange On A dropdownChoice

Hi Guys ;

I have a dropdown choice component that has an onchange behavior that works
as expected.

Now, somewhere along the code, i do mydropdown.setModelObject()...

I want the onchange behavior to be triggered without the user having to
click the dropdown . Is it possible ?

JOsh.

Re: Calling OnChange On A dropdownChoice

Posted by Josh Kamau <jo...@gmail.com>.
Thanks.. let me try that.

J

On Tue, Jun 26, 2012 at 10:18 AM, Martin Grigorov <mg...@apache.org>wrote:

> On Tue, Jun 26, 2012 at 10:14 AM, Josh Kamau <jo...@gmail.com>
> wrote:
> > Thanks for the prompt response.
> >
> > The dropdown gets repainted... That works fine.  Now i have other
> > components that gets repainted when the dropdown value is changed. I want
> > them to be repainted when i change the dropdown  value from inside the
> code.
>
> I'd suggest to broadcast an event (Wicket 1.5 server-side events) in this
> case.
>
> >
> > On Tue, Jun 26, 2012 at 10:02 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
> >
> >> Hi,
> >>
> >> If you change the model(object) then you just need to re-paint the
> >> dropdown and it will have the new value selected.
> >>
> >> If you want to select another value without user interaction you can
> >> use plain JavaScript: selectEl.selectedIndex = 3;
> >> See http://stackoverflow.com/a/6210445/497381
> >>
> >>
> >> On Tue, Jun 26, 2012 at 9:56 AM, Josh Kamau <jo...@gmail.com>
> wrote:
> >> > Hi Guys ;
> >> >
> >> > I have a dropdown choice component that has an onchange behavior that
> >> works
> >> > as expected.
> >> >
> >> > Now, somewhere along the code, i do mydropdown.setModelObject()...
> >> >
> >> > I want the onchange behavior to be triggered without the user having
> to
> >> > click the dropdown . Is it possible ?
> >> >
> >> > JOsh.
> >>
> >>
> >>
> >> --
> >> Martin Grigorov
> >> jWeekend
> >> Training, Consulting, Development
> >> http://jWeekend.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Calling OnChange On A dropdownChoice

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Jun 26, 2012 at 10:14 AM, Josh Kamau <jo...@gmail.com> wrote:
> Thanks for the prompt response.
>
> The dropdown gets repainted... That works fine.  Now i have other
> components that gets repainted when the dropdown value is changed. I want
> them to be repainted when i change the dropdown  value from inside the code.

I'd suggest to broadcast an event (Wicket 1.5 server-side events) in this case.

>
> On Tue, Jun 26, 2012 at 10:02 AM, Martin Grigorov <mg...@apache.org>wrote:
>
>> Hi,
>>
>> If you change the model(object) then you just need to re-paint the
>> dropdown and it will have the new value selected.
>>
>> If you want to select another value without user interaction you can
>> use plain JavaScript: selectEl.selectedIndex = 3;
>> See http://stackoverflow.com/a/6210445/497381
>>
>>
>> On Tue, Jun 26, 2012 at 9:56 AM, Josh Kamau <jo...@gmail.com> wrote:
>> > Hi Guys ;
>> >
>> > I have a dropdown choice component that has an onchange behavior that
>> works
>> > as expected.
>> >
>> > Now, somewhere along the code, i do mydropdown.setModelObject()...
>> >
>> > I want the onchange behavior to be triggered without the user having to
>> > click the dropdown . Is it possible ?
>> >
>> > JOsh.
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Calling OnChange On A dropdownChoice

Posted by Josh Kamau <jo...@gmail.com>.
Thanks for the prompt response.

The dropdown gets repainted... That works fine.  Now i have other
components that gets repainted when the dropdown value is changed. I want
them to be repainted when i change the dropdown  value from inside the code.

On Tue, Jun 26, 2012 at 10:02 AM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
> If you change the model(object) then you just need to re-paint the
> dropdown and it will have the new value selected.
>
> If you want to select another value without user interaction you can
> use plain JavaScript: selectEl.selectedIndex = 3;
> See http://stackoverflow.com/a/6210445/497381
>
>
> On Tue, Jun 26, 2012 at 9:56 AM, Josh Kamau <jo...@gmail.com> wrote:
> > Hi Guys ;
> >
> > I have a dropdown choice component that has an onchange behavior that
> works
> > as expected.
> >
> > Now, somewhere along the code, i do mydropdown.setModelObject()...
> >
> > I want the onchange behavior to be triggered without the user having to
> > click the dropdown . Is it possible ?
> >
> > JOsh.
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Calling OnChange On A dropdownChoice

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

If you change the model(object) then you just need to re-paint the
dropdown and it will have the new value selected.

If you want to select another value without user interaction you can
use plain JavaScript: selectEl.selectedIndex = 3;
See http://stackoverflow.com/a/6210445/497381


On Tue, Jun 26, 2012 at 9:56 AM, Josh Kamau <jo...@gmail.com> wrote:
> Hi Guys ;
>
> I have a dropdown choice component that has an onchange behavior that works
> as expected.
>
> Now, somewhere along the code, i do mydropdown.setModelObject()...
>
> I want the onchange behavior to be triggered without the user having to
> click the dropdown . Is it possible ?
>
> JOsh.



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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