try adding AjaxFormComponentUpdatingBehavior to your drop down

some thing like this

AjaxFormComponentUpdatingBehavior updateBehavior = new
AjaxFormComponentUpdatingBehavior("onchange")
       {
           private static final long serialVersionUID = 1L;
           protected void onUpdate(AjaxRequestTarget target)
           {

               target.addComponent(container);
           }


       };
       yourDropDown.add(updateBehavior);

so during the onChange the model object will get updated and you can access
the value by calling the getter

don't know if this is the best way though

On 7/13/07, Edi <[EMAIL PROTECTED]> wrote:


That's fine.

How to get the value of selected item in dropdown box?

Regards,
edi


Dipu Seminlal wrote:
>
> can you try target.addjavascript(javascript) or target.appendjavascript
> (javascript)
>
> regards
> Dipu
>
> On 7/13/07, Edi <[EMAIL PROTECTED]> wrote:
>>
>>
>> When onchange the DropDown box, how can I call the javascript function?
>>
>> for eg;
>>
>> makes.add(new AjaxFormComponentUpdatingBehavior("onchange")
>>                 {
>>                         protected void onUpdate(AjaxRequestTarget
target)
>>                         {
>>                                 target.addComponent(models);
>>                                 //how to call javascript function here.
>>                         }
>>                 });
>>
>>
>> igor.vaynberg wrote:
>> >
>> > On 7/13/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>> >>
>> >> On 7/13/07, Edi <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> >
>> >> > Could you please explain in detail manner?
>> >>
>> >>
>> >>
>> >> whats there to explain? in form.onsubmit or onchange event copy
values
>> >> from your textarea/textfield to the appropriate hiddenfield element
>> via
>> >> javascript.
>> >>
>> >> then when your form submits you can read the value out of that
>> >> hiddenfield
>> >> on serverside.
>> >>
>> >
>> > im not even sure you need the hiddenfield stuff, you might be able to
>> do
>> > it
>> > directly on textfield/textarea wicket components. just add both of
>> them.
>> > afaik if the tag is hidden via javascript it will not submit its
value
>> -
>> > so
>> > it should work automagically as long as you display:none one of them.
>> >
>> > -igor
>> >
>> >
>> >
>> > -igor
>> >>
>> >>
>> >>
>> >> igor.vaynberg wrote:
>> >> > >
>> >> > > On 7/12/07, Edi <[EMAIL PROTECTED]> wrote:
>> >> > >>
>> >> > >>
>> >> > >> Hi!
>> >> > >>
>> >> > >> I have one drop down like
>> >> > >>
>> >> > >>
>> <select><option>textbox</option><option>textarea</option></select>
>> >> > >>
>> >> > >> in the above case, I have 2 items, 1.textbox 2.textarea.
>> >> > >>
>> >> > >> If I select textbox, text box should be displayed below the
combo
>> >> > box. If
>> >> > >> I
>> >> > >> select textarea, textarea should be displayed but textbox
should
>> be
>> >> > >> hided.
>> >> > >>
>> >> > >> If I did not select anything, both textbox and textarea should
be
>> >> > hided.
>> >> > >>
>> >> > >> I have done using javascript. But I don't know how it is in
>> Wicket?
>> >> > >
>> >> > >
>> >> > >
>> >> > > simplest way to do this would be to add two wicket HiddenFields
-
>> one
>> >> > for
>> >> > > value of textbox and one for textarea, and then link them to the
>> ones
>> >> > you
>> >> > > created in the javascript.
>> >> > >
>> >> > > -igor
>> >> > >
>> >> > > I am newbie. So please give me your suggestions.
>> >> > >
>> >> > >
>> >> > >
>> >> > > Thanking You.
>> >> > >>
>> >> > >> Regards,
>> >> > >> Edi
>> >> > >>
>> >> > >> --
>> >> > >> View this message in context:
>> >> > >>
>> >>
>>
http://www.nabble.com/Regarding-onchange-DropDown-tf4072549.html#a11574089
>> >> >
>> >> > >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> > >>
>> >> > >>
>> >> > >>
>> >> >
>> >>
>>
-------------------------------------------------------------------------
>> >> > >> This SF.net email is sponsored by DB2 Express
>> >> > >> Download DB2 Express C - the FREE version of DB2 express and
take
>> >> > >> control of your XML. No limits. Just data. Click to get it now.
>> >> > >> http://sourceforge.net/powerbar/db2/
>> >> > >> _______________________________________________
>> >> > >> Wicket-user mailing list
>> >> > >> Wicket-user@lists.sourceforge.net
>> >> > >> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> > >>
>> >> > >
>> >> > >
>> >> >
>> >>
>>
-------------------------------------------------------------------------
>> >> > > This SF.net email is sponsored by DB2 Express
>> >> > > Download DB2 Express C - the FREE version of DB2 express and
take
>> >> > > control of your XML. No limits. Just data. Click to get it now.
>> >> > > http://sourceforge.net/powerbar/db2/
>> >> > > _______________________________________________
>> >> > > Wicket-user mailing list
>> >> > > Wicket-user@lists.sourceforge.net
>> >> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> > >
>> >> > >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >>
>>
http://www.nabble.com/Regarding-onchange-DropDown-tf4072549.html#a11574713
>> >> > Sent from the Wicket - User mailing list archive at Nabble.com.
>> >> >
>> >> >
>> >> >
>> >>
>>
-------------------------------------------------------------------------
>> >> >
>> >> > This SF.net email is sponsored by DB2 Express
>> >> > Download DB2 Express C - the FREE version of DB2 express and take
>> >> > control of your XML. No limits. Just data. Click to get it now.
>> >> > http://sourceforge.net/powerbar/db2/
>> >> > _______________________________________________
>> >> > Wicket-user mailing list
>> >> > Wicket-user@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >> >
>> >>
>> >>
>> >
>> >
>>
-------------------------------------------------------------------------
>> > This SF.net email is sponsored by DB2 Express
>> > Download DB2 Express C - the FREE version of DB2 express and take
>> > control of your XML. No limits. Just data. Click to get it now.
>> > http://sourceforge.net/powerbar/db2/
>> > _______________________________________________
>> > Wicket-user mailing list
>> > Wicket-user@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Regarding-onchange-DropDown-tf4072549.html#a11576058
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>>
-------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>

--
View this message in context:
http://www.nabble.com/Regarding-onchange-DropDown-tf4072549.html#a11576445
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to