Why not just put a filter on your 'global' feedbackpanel and filter out
the messages that you already display for each component? E.g. I have
the following code in a form:

   private void addGlobalSubmitPanel() {
        final List<FormComponent> components = getFormComponents();
        final FeedbackPanel feedback = new FeedbackPanel(FEEDBACK);
        feedback.setFilter(new IFeedbackMessageFilter() {
            public boolean accept(FeedbackMessage message) {
                return !components.contains(message.getReporter());
            }
        });
        add(feedback);
    }

    private List<FormComponent> getFormComponents() {
        final List<FormComponent> components = new
        ArrayList<FormComponent>();
        visitFormComponents(new FormComponent.IVisitor() {
            public Object formComponent(IFormVisitorParticipant
            formComponent) {
                final FormComponent fc = (FormComponent)formComponent;
                components.add(fc);
                return Component.IVisitor.CONTINUE_TRAVERSAL;
            }
        });
        return components;
    }

> > 
> > Hi.  Can anyone recommend a good strategy for handling and dislplaying
> > validation error messages when using Ajax? 
> > 
> > I want my basic field validation error to show next to the relevant input
> > text boxes, and have used my own FormComponentFeedbackBorder to do this.  
> > 
> > I still want a feedback panel for more fatal backend errors - eg, "record
> > already exists", "concurrent record modification", etc.  
> > 
> > Problem.  If I put a feedback panel on the page, and repaint this in my
> > button's onError with target.addComponent(feedback) - then I get
> > duplicates of my field validation errors in my panel.  Not what I want.  
> > 
> > If I only repaint the feedback onSubmit then I can catch the backend error
> > and display my message. But subsequent Ajax form submissions don't refresh
> > the page, so the error message in the feedback panel "sticks" on the page.
> > 
> > Not sure how to clear out existing errors in the feedback panel when using
> > Ajax, so have now used a label on my page instead, and manually clean up
> > after myself.  But is this the best way to go?
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Ajax-validation-error-messages-tp19190006p19190919.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]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to