whatever you are using to submit the form with ajax has an
onError(target) method that you can override and update the feedback
panel with.

-igor

On Sun, Feb 20, 2011 at 10:24 AM, eugenebalt <[email protected]> wrote:
>
> My code is below.
>
> 1) In Form Constructor:
>
>    public MyForm(String id) {
>        super(id);
>
>        // add BeginDate/EndDate text fields: these require validation
>        add(new TextField("bdate", new PropertyModel(myBean, "bdate"))
>        .add(new ErrorDateValidator1())
>        .add(new ErrorDateValidator2()));
>
>        add(new TextField("edate", new PropertyModel(myBean, "edate"))
>        .add(new ErrorDateValidator1())
>        .add(new ErrorDateValidator2()));
>
>        // add Feedback Panel
>        FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
>        feedbackPanel.setOutputMarkupId(true);
>        add(feedbackPanel);
>
>        // add AJAX Download object - from example
>        final AJAXDownload download = new AJAXDownload() {
>
>                  @Override
>            protected IResourceStream getResourceStream() {
>                 File f = generateFile();
>                 return new FileResourceStream(f);
>                 }
>
>            @Override
>             protected String getFileName() {
>                        return "report.xls";
>             }
>         };
>         add(download);   // add to the form
>
>         // add Submit AjaxButton
>         add(new AjaxButton("submitButton") {
>
>        @Override
>        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>
>             // Refresh Feedback Panel
>             target.addComponent(form.get("feedback"));
>
>             // finally initiate the download
>             download.initiate(target);
>                        }
>          });
>
>
>    }
>
>
> 2) Form onSubmit() is blank. It never even gets this far if there is a
> Validator error, and it doesn't get to the Ajax getResourceStream() either
> in this case. If there are no validation errors, the download works OK. But
> if there are validation messages upon submission, they must be displayed in
> the Feedback Panel.
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Making-Ajax-Download-Work-With-Validator-Messages-in-FeedbackPanel-tp3315334p3315343.html
> Sent from the Users forum 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