Error Message Not Getting Removed
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); } };
Re: Error Message Not Getting Removed
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); } };
Re: Error Message Not Getting Removed
I don't see that you have added the feedback in the onSubmit method You should do @Override onsubmit( ){ target.addComponent( feedback ); } -- View this message in context: http://www.nabble.com/Error-Message-Not-Getting-Removed-tp24574168p24574336.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Error Message Not Getting Removed
Whoops. My bad. Thanks! Mathias Nilsson wrote: I don't see that you have added the feedback in the onSubmit method You should do @Override onsubmit( ){ target.addComponent( feedback ); } -- View this message in context: http://www.nabble.com/Error-Message-Not-Getting-Removed-tp24574168p24574877.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org