You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sandor Feher <sf...@bluesystem.hu> on 2022/10/17 10:22:49 UTC

Catch start and finish of upload process on MultiFileUploadField

Hi,

I have a form which contains a MultiFileUploadField beside other input 
fields. (In this case uploading file(s) is optional. )

I would like to catch somehow the start and the end of upload process to 
let users know we do something with the files.

Now I use IndicatingAjaxButton for that but catching it within onSubmit 
is late.

This might be trivial but I did not find solution for it.

I made a quickstart project. 
https://github.com/sfeher/multiplefileuploadprogress

Wicket 7.18.0

Thank you !


-- 
Üdvözlettel/Kind Regards, Fehér Sándor


...Fehér Sándor...            ---    ....Sandor Feher....
  fejlesztési vezetõ           ---     development manager
  Blue System Kft.             ---      Blue System Ltd.
..........................................................................................
http://www.bluesystem.hu : http://www.adatmegorzo.hu : http://www.bluehosting.hu
..........................................................................................

Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy bármely csatolmányát.
Please consider the environment before printing this e-mail and any associated attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Catch start and finish of upload process on MultiFileUploadField

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 18, 2022 at 1:19 PM Sandor Feher <sf...@bluesystem.hu> wrote:

> Okay, the process is  clear now. Thank you.
> The question is which method should I override to inject my code and
> show my panel when indicator shows up.
>

1. Override updateAjaxAttributes() -
https://github.com/apache/wicket/blob/3a29e91665a66dc0dadadcd1edd1abcb124d40b8/wicket-core/src/main/java/org/apache/wicket/ajax/markup/html/form/AjaxButton.java#L170
2. Add an IAjaxCallListener to the attributes -
https://github.com/apache/wicket/blob/3a29e91665a66dc0dadadcd1edd1abcb124d40b8/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java#L258
3. Add JS logic to be called onBeforeSend() callback to show your panel



>
>
>
> 2022.10.18. 10:08 keltezéssel, Martin Grigorov írta:
> > On Tue, Oct 18, 2022 at 10:50 AM Sandor Feher <sf...@bluesystem.hu>
> wrote:
> >
> >> Hi,
> >>
> >> On Mon, Oct 17, 2022 at 1:23 PM Sandor Feher <sf...@bluesystem.hu>
> wrote:
> >>
> >>>> Now I use IndicatingAjaxButton for that but catching it within
> onSubmit
> >>>> is late.
> >>>>
> >>> What do you mean with "is late" ?
> >> As I realized when the first line of onSubmit function is executed the
> >> file(s)  already get
> >> uploaded.
> >>
> >>> When exactly do you need the notifications ?
> >> When uploading process is started.
> >>
> > IndicatingAjaxButton starts showing the indicator before the form
> > submittion (i.e. when the process starts), then the files are uploaded,
> and
> > then when all the data is sent to the server the Form#onSubmit or onError
> > is called, and finally when the Ajax response is returned
> > IndicatingAjaxButton hides the indicator
> >
> >
> >
> >>
> >> --
> >> Üdvözlettel/Kind Regards, Fehér Sándor
> >>
> >>
> >> ...Fehér Sándor...            ---    ....Sandor Feher....
> >>    fejlesztési vezetõ           ---     development manager
> >>    Blue System Kft.             ---      Blue System Ltd.
> >>
> >>
> ..........................................................................................
> >> http://www.bluesystem.hu  :http://www.adatmegorzo.hu  :
> >> http://www.bluehosting.hu
> >>
> >>
> ..........................................................................................
> >>
> >> Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy
> >> bármely csatolmányát.
> >> Please consider the environment before printing this e-mail and any
> >> associated attachments.
> >>
>
> --
> Üdvözlettel/Kind Regards, Fehér Sándor
>
>
> ...Fehér Sándor...            ---    ....Sandor Feher....
>   fejlesztési vezetõ           ---     development manager
>   Blue System Kft.             ---      Blue System Ltd.
>
> ..........................................................................................
> http://www.bluesystem.hu : http://www.adatmegorzo.hu :
> http://www.bluehosting.hu
>
> ..........................................................................................
>
> Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy
> bármely csatolmányát.
> Please consider the environment before printing this e-mail and any
> associated attachments.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Catch start and finish of upload process on MultiFileUploadField

Posted by Sandor Feher <sf...@bluesystem.hu>.
Okay, the process is  clear now. Thank you.
The question is which method should I override to inject my code and 
show my panel when indicator shows up.



2022.10.18. 10:08 keltezéssel, Martin Grigorov írta:
> On Tue, Oct 18, 2022 at 10:50 AM Sandor Feher <sf...@bluesystem.hu> wrote:
>
>> Hi,
>>
>> On Mon, Oct 17, 2022 at 1:23 PM Sandor Feher <sf...@bluesystem.hu> wrote:
>>
>>>> Now I use IndicatingAjaxButton for that but catching it within onSubmit
>>>> is late.
>>>>
>>> What do you mean with "is late" ?
>> As I realized when the first line of onSubmit function is executed the
>> file(s)  already get
>> uploaded.
>>
>>> When exactly do you need the notifications ?
>> When uploading process is started.
>>
> IndicatingAjaxButton starts showing the indicator before the form
> submittion (i.e. when the process starts), then the files are uploaded, and
> then when all the data is sent to the server the Form#onSubmit or onError
> is called, and finally when the Ajax response is returned
> IndicatingAjaxButton hides the indicator
>
>
>
>>
>> --
>> Üdvözlettel/Kind Regards, Fehér Sándor
>>
>>
>> ...Fehér Sándor...            ---    ....Sandor Feher....
>>    fejlesztési vezetõ           ---     development manager
>>    Blue System Kft.             ---      Blue System Ltd.
>>
>> ..........................................................................................
>> http://www.bluesystem.hu  :http://www.adatmegorzo.hu  :
>> http://www.bluehosting.hu
>>
>> ..........................................................................................
>>
>> Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy
>> bármely csatolmányát.
>> Please consider the environment before printing this e-mail and any
>> associated attachments.
>>

-- 
Üdvözlettel/Kind Regards, Fehér Sándor


...Fehér Sándor...            ---    ....Sandor Feher....
  fejlesztési vezetõ           ---     development manager
  Blue System Kft.             ---      Blue System Ltd.
..........................................................................................
http://www.bluesystem.hu : http://www.adatmegorzo.hu : http://www.bluehosting.hu
..........................................................................................

Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy bármely csatolmányát.
Please consider the environment before printing this e-mail and any associated attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Catch start and finish of upload process on MultiFileUploadField

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 18, 2022 at 10:50 AM Sandor Feher <sf...@bluesystem.hu> wrote:

> Hi,
>
> On Mon, Oct 17, 2022 at 1:23 PM Sandor Feher <sf...@bluesystem.hu> wrote:
>
> >> Now I use IndicatingAjaxButton for that but catching it within onSubmit
> >> is late.
> >>
>
> >What do you mean with "is late" ?
>
> As I realized when the first line of onSubmit function is executed the
> file(s)  already get
> uploaded.
>
> >When exactly do you need the notifications ?
>
> When uploading process is started.
>

IndicatingAjaxButton starts showing the indicator before the form
submittion (i.e. when the process starts), then the files are uploaded, and
then when all the data is sent to the server the Form#onSubmit or onError
is called, and finally when the Ajax response is returned
IndicatingAjaxButton hides the indicator



>
>
> --
> Üdvözlettel/Kind Regards, Fehér Sándor
>
>
> ...Fehér Sándor...            ---    ....Sandor Feher....
>   fejlesztési vezetõ           ---     development manager
>   Blue System Kft.             ---      Blue System Ltd.
>
> ..........................................................................................
> http://www.bluesystem.hu  :http://www.adatmegorzo.hu  :
> http://www.bluehosting.hu
>
> ..........................................................................................
>
> Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy
> bármely csatolmányát.
> Please consider the environment before printing this e-mail and any
> associated attachments.
>

Re: Catch start and finish of upload process on MultiFileUploadField

Posted by Sandor Feher <sf...@bluesystem.hu>.
Hi,

On Mon, Oct 17, 2022 at 1:23 PM Sandor Feher <sf...@bluesystem.hu> wrote:

>> Now I use IndicatingAjaxButton for that but catching it within onSubmit
>> is late.
>>

>What do you mean with "is late" ?

As I realized when the first line of onSubmit function is executed the file(s)  already get
uploaded.

>When exactly do you need the notifications ?

When uploading process is started.


-- 
Üdvözlettel/Kind Regards, Fehér Sándor


...Fehér Sándor...            ---    ....Sandor Feher....
  fejlesztési vezetõ           ---     development manager
  Blue System Kft.             ---      Blue System Ltd.
..........................................................................................
http://www.bluesystem.hu  :http://www.adatmegorzo.hu  :http://www.bluehosting.hu
..........................................................................................

Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy bármely csatolmányát.
Please consider the environment before printing this e-mail and any associated attachments.

Re: Catch start and finish of upload process on MultiFileUploadField

Posted by Martin Grigorov <mg...@apache.org>.
Hi,



On Mon, Oct 17, 2022 at 1:23 PM Sandor Feher <sf...@bluesystem.hu> wrote:

> Hi,
>
> I have a form which contains a MultiFileUploadField beside other input
> fields. (In this case uploading file(s) is optional. )
>
> I would like to catch somehow the start and the end of upload process to
> let users know we do something with the files.
>
> Now I use IndicatingAjaxButton for that but catching it within onSubmit
> is late.
>

What do you mean with "is late" ?
When exactly do you need the notifications ?


>
> This might be trivial but I did not find solution for it.
>
> I made a quickstart project.
> https://github.com/sfeher/multiplefileuploadprogress
>
> Wicket 7.18.0
>
> Thank you !
>
>
> --
> Üdvözlettel/Kind Regards, Fehér Sándor
>
>
> ...Fehér Sándor...            ---    ....Sandor Feher....
>   fejlesztési vezetõ           ---     development manager
>   Blue System Kft.             ---      Blue System Ltd.
>
> ..........................................................................................
> http://www.bluesystem.hu : http://www.adatmegorzo.hu :
> http://www.bluehosting.hu
>
> ..........................................................................................
>
> Kérem gondoljon a környezetre mielõtt kinyomtatná ezt az e-mailt vagy
> bármely csatolmányát.
> Please consider the environment before printing this e-mail and any
> associated attachments.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>