Hello,
I hope I'm not spamming this forum too much -.- I have a hard time finding
viable solutions for seemingly "easy" questions.
Currently I want a textfield which will send a request only if either enter
is pressed or when the textfield looses focus.
I have an AjaxEventBehaviour implementation which does the following:
(the action in question is "onkeydown" or "onblur" in my case
protected CharSequence getEventHandler() {
if(action.equalsIgnoreCase("onkeydown")) {
CharSequence handler = super.getEventHandler();
String check = "javascript: if (event.keyCode == 13) { ";
String endCheck = " return false; }";
return check + handler + endCheck;
}
else {
return super.getEventHandler();
}
}
This works fine, the request gets fired when I want to. However the value of
the textfield isn't up to date.
It works when I have the following
textField.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget arg0) {
//do nothing
}});
The Textfield has as a model a PropertyModel. Whenever I change something in
the textfield the value is send to the server, but I want this communication
taking place only if either enter is pressed or the textfield looses focus
(onblur). When I remove the OnChangeAjaxBehaviour then the Property "name"
isn't up to date...
I fail at putting it together the way I want to.... can someone please
help?
- Tom
--
View this message in context:
http://www.nabble.com/Sending-Ajaxrequest-only-if-enter-is-pressed-in-a-textfield-tp19252434p19252434.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]