FilesSelectedBehavior

On Sun, Jan 5, 2025 at 9:58 PM Erwan Tanajaya <r_...@yahoo.com.invalid>
wrote:

>  Thank you Ernesto, if you don't mind can you give me hint what is the
> Class name ?
>
>     On Friday, January 3, 2025 at 08:41:07 PM GMT+7, Ernesto Reinaldo
> Barreiro <reier...@gmail.com> wrote:
>
>  Mind there is some behavior that does this validation via AJAX too.
>
> On Thu, Jan 2, 2025 at 9:20 PM Erwan Tanajaya <r_...@yahoo.com.invalid>
> wrote:
>
> >  i will consider  add handling of client side errors if this problem is
> > intended wicket behavior.
> >
> >    On Thursday, January 2, 2025 at 09:35:36 PM GMT+7, Maxim Solodovnik <
> > solomax...@gmail.com> wrote:
> >
> >  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
> > > >
> > >
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
>



-- 
Regards - Ernesto Reinaldo Barreiro

Reply via email to