You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jp...@mchsi.com on 2009/07/20 19:31:02 UTC

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

Posted by jpalmer1026 <jp...@mchsi.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Error Message Not Getting Removed

Posted by Mathias Nilsson <wi...@gmail.com>.
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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Error Message Not Getting Removed

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
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  <jp...@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);
>             }
>         };
>