Re: How to trigger Ajax event from client side javascript?
OnChangeAjaxBehavior applies only to AbstractTextComponent. Such components are: TextField and TextArea. HiddenField is not! You may try with a AjaxFormComponentUpdatingBehavior instead. changed.add(new AjaxFormComponentUpdatingBehavior(myevent) {...}); and in JavaScript: function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; document.forms[0].changed.myevent(); } } } On Fri, 2008-09-05 at 09:59 -0700, liza6218 wrote: Hi, I'm trying to trigger OnChangeAjaxBehavior on an HiddenField (or TextField) change from client side javascript. Here is the code in html: function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; } } input type=hiden wicket:id=changed/ in wicket: Form form = new Form(form); add(form); final HidenField changed= new HidenField (changed); form.add(HidenField); final Label label = new Label(selectedValue); label.setOutputMarkupId(true); form.add(label); OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(label); } }; changed.add(onChangeAjaxBehavior); Any help will be very much appreciated. - Lisa - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to trigger Ajax event from client side javascript?
On Sat, 06 Sep 2008, Martin Grigorov wrote: OnChangeAjaxBehavior applies only to AbstractTextComponent. Such components are: TextField and TextArea. HiddenField is not! Hmm... not exactly. OnChangeAjaxBehavior is an AjaxFormComponentUpdatingBehavior, bound to onchange Javascript event, with some textcomponent-specific tuning (it reacts also to mouse cut and paste, and disables browser autocompletion, because it would not detect input produced by it). So it works e.g. with DropDownChoice as well. I think that the problem is more that the event from the hidden textfield is not fired, in which your solution function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; document.forms[0].changed.myevent(); } } } should help. Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to trigger Ajax event from client side javascript?
Hi Timo, You are right! Looking closer at the code I see that it just makes some additional work for TextField and TextArea. Thanks! On Sat, 2008-09-06 at 21:37 +0300, Timo Rantalaiho wrote: On Sat, 06 Sep 2008, Martin Grigorov wrote: OnChangeAjaxBehavior applies only to AbstractTextComponent. Such components are: TextField and TextArea. HiddenField is not! Hmm... not exactly. OnChangeAjaxBehavior is an AjaxFormComponentUpdatingBehavior, bound to onchange Javascript event, with some textcomponent-specific tuning (it reacts also to mouse cut and paste, and disables browser autocompletion, because it would not detect input produced by it). So it works e.g. with DropDownChoice as well. I think that the problem is more that the event from the hidden textfield is not fired, in which your solution function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; document.forms[0].changed.myevent(); } } } should help. Best wishes, Timo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to trigger Ajax event from client side javascript?
Hi, I'm trying to trigger OnChangeAjaxBehavior on an HiddenField (or TextField) change from client side javascript. Here is the code in html: function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; } } input type=hiden wicket:id=changed/ in wicket: Form form = new Form(form); add(form); final HidenField changed= new HidenField (changed); form.add(HidenField); final Label label = new Label(selectedValue); label.setOutputMarkupId(true); form.add(label); OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(label); } }; changed.add(onChangeAjaxBehavior); Any help will be very much appreciated. - Lisa -- View this message in context: http://www.nabble.com/How-to-trigger-Ajax-event-from-client-side-javascript--tp19335490p19335490.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]