In my understanding only EITHER onSubmit or onError is called. If you
call error(xx) in onSubmit, you must refesh the feedback panel in the
onSubmit-branch TOO (separately).
**
Martin
2009/7/20 jpalmer1...@mchsi.com:
I have a form that's using an AjaxSubmitLink to show / hide a panel. I have
overriden the onError() method to add a feedbackPanel to the page to display
any error messages that may exist. The problem I'm having is the error
messages are remaining on the screen even after the problem is fixed. Any
suggestions? My code is as follows:
final AjaxSubmitLink verifyPinLink = new AjaxSubmitLink(verifyPinLink) {
@Override
public void onSubmit(AjaxRequestTarget target, Form form) {
Declaration declaration = (Declaration)
form.getModelObject();
ParcelIdentification pid =
declarationService.findParcelIdentification(declaration.getPin());
if (pid == null) {
form.error(No PIN found for PIN +
declaration.getPin());
} else {
InitiateDeclarationVerifyPanel decVerifyPanel = new
InitiateDeclarationVerifyPanel(verifyPanel, pid);
parent.addOrReplace(decVerifyPanel);
parent.setVisible(true);
this.setEnabled(false);
pinText.setEnabled(false);
reenterPinLink.setVisible(true);
button.setVisible(true);
target.addComponent(this);
target.addComponent(parent);
target.addComponent(reenterPinLink);
target.addComponent(button);
target.addComponent(pinText);
}
}
@Override
public void onError(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
}
};