from mobile (sorry for typos ;)

On Thu, Jan 2, 2025, 21:26 Thomas Heigl <tho...@umschalt.com> wrote:

> Hi Erwan,
>
> To clarify: Did this work for you in previous versions? Is this a
> regression you are reporting or just a general question?
>
> Best,
>
> Thomas
>
> On Thu, Jan 2, 2025 at 4:07 AM Erwan Tanajaya <r_...@yahoo.com.invalid>
> wrote:
>
> > Hello all,
> >
> > I found an issue with AjaxButton and FileUploadField, every time i upload
> > file more than 5MB error message not shown in FeedbackPanel, custom error
> > message also not shown in FeedbackPanel, is there something wrong with my
> > code ?
>

I believe you need to add handling of client side errors
IMO fike size might bw checked by browser ....

>
> > this is my code :
> >
> >         // FeedbackPanel outside the form
> >         FeedbackPanel feedbackPanel = new FeedbackPanel("notifications");
> >         feedbackPanel.setOutputMarkupId(true);
> >         add(feedbackPanel);
> >
> >         // Form for file upload
> >         Form<Void> form = new Form<>("form");
> >         form.setMultiPart(true);
> >         form.setMaxSize(Bytes.megabytes(5)); // Set a file size limit (5
> > MB)
> >         form.setOutputMarkupId(true);
> >         add(form);
> >
> >         // FileUploadField for file input
> >         FileUploadField fileUploadField = new
> > FileUploadField("fileUpload");
> >         form.add(fileUploadField);
> >
> >         // AjaxButton for submission
> >         AjaxButton ajaxButton = new AjaxButton("submitButton", form) {
> >             @Override
> >             protected void onSubmit(AjaxRequestTarget target) {
> >                 super.onSubmit(target);
> >
> >                 info("File uploaded successfully.");
> >
> >                 target.add(feedbackPanel); // Update the FeedbackPanel
> >             }
> >
> >             @Override
> >             protected void onError(AjaxRequestTarget target) {
> >                 super.onError(target);
> >
> >                 // Add custom error message manually
> >                 error("A custom error message for testing.");
> >
> >                 // Ensure errors are visible
> >                 target.add(feedbackPanel); // Update the FeedbackPanel
> >             }
> >         };
> >         ajaxButton.setOutputMarkupId(true);
> >         form.add(ajaxButton);
> >
> >
> >
> > Environtment :
> > Wicket 10.3.0
> > Java 21
> > Tomcat 11
> > Maven 3.9.9
> >
> > Best Regards,
> > Erwan
> >
>

Reply via email to