Can you create a quick start illustrating this?
On Wed, Jan 1, 2025 at 10:07 PM Erwan Tanajaya <[email protected]>
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 ?
>
> 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
>
--
Regards - Ernesto Reinaldo Barreiro