Yay, got it. This JavaScript blurb will trigger onchange after a half-second pause:
-----------js accessible to page-------- var timerN = 0; var timerElement; function resetTimer(element) { timerElement = element; var n = ++timerN; setTimeout(function() { timerCheck(n); }, 500); } function timerCheck(n) { if (n == timerN) { timerElement.blur(); timerElement.focus(); } } --------------------------------------- And then a little behavior to activate it for text fields: class KeyPauseUpdate extends AjaxFormComponentUpdatingBehavior { public KeyPauseUpdate() { super("onchange"); } @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("onkeypress", "resetTimer(this);"); } @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(content); } } So this fixes my immediate problem. (Except for slow typists and even slower databases, but whatevs.) It would be easy to package as a free-standing behavior, which I'll probably do for Databinder. Unless you guys decide it's in scope. ;) Nathan YGwyn Evans wrote: > I don't know if it's technically feasible, but I think you've got the > answer with your last sentence - Even if not, I can't believe it's a > good idea to trigger a request per-keystroke - how feasible would it > be to send only when the <space> char is entered? > > /Gwyn > > On 14/07/06, Nathan Hamblen <[EMAIL PROTECTED]> wrote: >> What are people doing to make sure their ajax responses apply to pages >> in the correct order? I'm using an onkeyup form component updater for a >> find-as-you-type query a fairly large database. Incorrect results are >> often rendered because the second-to-last request responds after the >> actual last request. (This makes sense, as a query returning fewer >> results is often faster.) >> >> It's a "like '%token%'" query so mysql has to scan the whole table. >> Bummer, but I need that first %. I played around with the throttle delay >> but it didn't make a difference. I'd like to just throw out the >> out-of-order response. Even better would be if the ajax request didn't >> happen until the user paused typing. >> >> Any ideas? >> >> Nathan ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user