I think I was having a problem because I was using
AjaxFormComponentUpdatingBehavior to update the listbox when the textfield
changed.  I wanted to add the Enter capability to that and that is where I
got a little confused.  What seems to work is overriding the
getCallbackScript of the original keyup event to wrap the normal callback
script with an if stmt to control the flow based upon the key pressed. 
Below is what seems to work.  Are there other (better) ways to do this?

AjaxEventBehavior autoUpdate = new
AjaxFormComponentUpdatingBehavior("onkeyup") {
  protected CharSequence getCallbackScript(CharSequence partialCall,
CharSequence onSuccessScript, CharSequence onFailureScript) {
    final StringBuffer script = new StringBuffer();
    script.append("var kc=wicketKeyCode(event); if (kc!=13) {");
    script.append(super.getCallbackScript(partialCall, onSuccessScript,
onFailureScript));
    script.append("} else {document.all.");
    script.append(submit.getId());
    script.append(".click();}");
    return script;
  }

-- 
View this message in context: 
http://www.nabble.com/AJAX-Events---which-key--tf2338865.html#a6508899
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to