Hi everyone!
I'm having a little problem..
I have an Ajax "editable table" made with rows of custom components similar to
AjaxEditableLabel, that while in "edit mode" use a behavior like this one:
protected class EditorBehavior extends AbstractDefaultAjaxBehavior{
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
String js="{wicketAjaxGet('" + getCallbackUrl() +
"&'+this.name+'='+wicketEncode(this.value)); return false;}";
tag.put("onblur", js);
}
@Override
protected void respond(AjaxRequestTarget target) {
FormComponent c = (FormComponent) getEditorComponent();
c.processInput();
if(c.hasErrorMessage()){
Serializable msg = c.getFeedbackMessage().getMessage();
Util.showAlert(target, c, msg.toString());
}
}
}
(Util.showAlert adds to the component a behavior that shows an alert)
Everything works fine, but I need to add another behavior to intercept when the
user presses Enter (bound to onkeyup), so that I can validate the row as a
whole.
When I press enter, two requests are fired: one for onblur and one for onkeyup.
My problem is that even if the onblur request finds an error during validation
(and shows the corresponding alert), the second request has no way to know
that, since feedback messages are cleaned up at the end of each request..
Any hint on how I could handle this? Should I put a flag somewhere? Or maybe
there's a way to stop the second request when my EditorBehavior finds a
validation error?
Many thanks for your time!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]