You may try this: def ajaxLiveText(value: String, func: String => JsCmd, attrs: (String, String)*): Elem = { S.fmapFunc(S.SFuncHolder(func)) {funcName => (attrs.foldLeft(<input type="text" value={value}/>)(_ % _)) % ("onkeyup" -> makeAjaxCall(JsRaw("'" + funcName + "=' + encodeURIComponent(this.value)"))) } }
It works like SHtml.ajaxText, but calls the server after each key press. Cheers, Chris On 18 Jan., 07:36, Jay Cain <cain....@gmail.com> wrote: > Is there a SHtml.ajaxText equivalent that will perfrom an ajax call > when the onkeyPress is invoked? I want the ability to query the db to > see if a particular username is "available" or "unavailable" each time > the user types in a letter within the input field. I can only get > this accomplished on blur. > > I tried the following: > > SHtml.text(user.username, user.username = _) % ("onkeyPress" -> > ajaxCall(JE.JsRaw("$('#username').attr('value')"), s => > isUsernameAvailable(s))) } > > but no bueno > > Jay C.
-- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.