Move the logic in the onClick() into a helper method (that takes an AjaxRequestTarget) and just call that from the onUpdate() method?
On Sat, Apr 3, 2010 at 11:17 AM, Mathias Nilsson <wicket.program...@gmail.com> wrote: > Hi, > > I have a a listview in a form that contains cart items. > > Every list view item has quantity textfield and ajaxsubmitlink. Now I want > to add a behavior that enables enter keypress for the textfield. > > public abstract class KeyEnterBehavior extends > AjaxFormComponentUpdatingBehavior{ > > private static final long serialVersionUID = 1L; > > public KeyEnterBehavior() { > super("onkeypress"); > } > > @Override > protected void onComponentTag(ComponentTag tag) { > Component myComponent = getComponent(); > if (myComponent.isEnabled() && myComponent.isEnableAllowed()) { > CharSequence handler = generateCallbackScript(new > AppendingStringBuffer("wicketAjaxPost('").append(getCallbackUrl(false)).append("', > wicketSerialize(Wicket.$('"+ getComponent().getMarkupId() + "'))")); > String event = "if (event.keyCode == 13) {"+ handler.toString() + "}"; > tag.put("onkeypress", event); > } > } > } > > quantity.add( new KeyEnterBehavior(){ > private static final long serialVersionUID = 1L; > �...@override > protected void onUpdate(AjaxRequestTarget target) { > } > }); > > in the onUpdate I would like to programmatically click the AjaxSubmitLink. > Any pointers? > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org