You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by ssamarin <st...@gmail.com> on 2017/07/27 12:28:39 UTC

Toastr popups and Form's onSubmit

Hello,
I'm integrating toastr popups (https://github.com/CodeSeven/toastr) into our
application. For it to work properly, I need to add Behavior to Label and
then add that label to AjaxRequestTarget. 

I'm wondering on how to wire this with Form's and onSubmit methods. Custom
Ajax buttons everywhere could be a solution, but means quite a lot of
rewrite. 

May be there's some best practice? 

Regards, Stepan.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Toastr popups and Form's onSubmit

Posted by ssamarin <st...@gmail.com>.
Thanks Vit, this worked. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320p4678396.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Toastr popups and Form's onSubmit

Posted by Vit Rozkovec <ro...@email.cz>.
Would it work to add a behavior to the component, passing behavior's url 
to Toastr and calling this url via Wicket.Ajax?
In the behavior you would then redirect to the page you need.



On 07/27/2017 04:43 PM, Martin Grigorov wrote:
> You will have to do some refactoring ...
>
> Instead of using Wicket's setResponsePage() you will need to use Toastr's
> callbacks
>
> toastr.options.onHidden = function() { console.log('goodbye');
> }toastr.options.onCloseClick = function() { console.log('close button
> clicked'); }
>
>
> and do the redirect with JavaScript: document.location='../the/next/page';
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Jul 27, 2017 at 5:18 PM, ssamarin <st...@gmail.com> wrote:
>
>> I probably don't need a label, problem is that onSubmit of the form
>> typically
>> calls redirect to another page.
>>
>> I tried AjaxButton, but can't get redirect being called *after* toastr
>> popup
>> shows up. Ideally, I want popup, wait few seconds till it closes (or user
>> closes it) - do redirect.
>>
>> --
>> View this message in context: http://apache-wicket.1842946.
>> n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320p4678329.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


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


Re: Toastr popups and Form's onSubmit

Posted by Martin Grigorov <mg...@apache.org>.
You will have to do some refactoring ...

Instead of using Wicket's setResponsePage() you will need to use Toastr's
callbacks

toastr.options.onHidden = function() { console.log('goodbye');
}toastr.options.onCloseClick = function() { console.log('close button
clicked'); }


and do the redirect with JavaScript: document.location='../the/next/page';

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jul 27, 2017 at 5:18 PM, ssamarin <st...@gmail.com> wrote:

> I probably don't need a label, problem is that onSubmit of the form
> typically
> calls redirect to another page.
>
> I tried AjaxButton, but can't get redirect being called *after* toastr
> popup
> shows up. Ideally, I want popup, wait few seconds till it closes (or user
> closes it) - do redirect.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320p4678329.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Toastr popups and Form's onSubmit

Posted by ssamarin <st...@gmail.com>.
I probably don't need a label, problem is that onSubmit of the form typically
calls redirect to another page.

I tried AjaxButton, but can't get redirect being called *after* toastr popup
shows up. Ideally, I want popup, wait few seconds till it closes (or user
closes it) - do redirect. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320p4678329.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Toastr popups and Form's onSubmit

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

Do you really need a Label ?
I think you should be able to accomplish the same with:
target.appendJavaScript(Toastr.build(...));

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jul 27, 2017 at 3:28 PM, ssamarin <st...@gmail.com> wrote:

> Hello,
> I'm integrating toastr popups (https://github.com/CodeSeven/toastr) into
> our
> application. For it to work properly, I need to add Behavior to Label and
> then add that label to AjaxRequestTarget.
>
> I'm wondering on how to wire this with Form's and onSubmit methods. Custom
> Ajax buttons everywhere could be a solution, but means quite a lot of
> rewrite.
>
> May be there's some best practice?
>
> Regards, Stepan.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Toastr-popups-and-Form-s-onSubmit-tp4678320.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>