Are you using this notification plugin for all flash messages on your site?
If so, why not just incorporate it into the layout and use response.flash
(and session.flash) as usual? In the layout, you could have something like:
<script>
$.notific8('{{=response.flash}}');
</script>
If you need to pass in options as well, you could make response.flash a
dictionary holding both the message and the options and convert the options
part to JSON in the layout.
Anthony
On Thursday, June 29, 2017 at 6:49:20 AM UTC-4, Filipe Reis wrote:
>
> Hello, I was wondering if someone could help me in figuring this out.
>
> I have a view that when the user click on a button opens a modal with a
> insertion form.
>
> I'm calling it by doing this way:
> web2py_ajax_page("GET", url, "", target);
>
> url - being the url like /house/create
> target - being the div where the form will appear
>
> on the form validation I'm trying to use this plugin:
> https://github.com/willsteinmetz/notific8 to show flash messages as it is
> in javascript when the form is an error I am able to do this:
> response.js = "$.notific8('Please fill all necessary fields.', {heading:
> 'Error'});"
>
> All works ok in here..
>
> but if I try the same when the form is success does not work because I do
> a redirect after which resets the page and there is no flash message no
> more...
>
> I know that session.flash migh work for this cases, but I'm not able to
> understand how to make them work together in this case since this
> notification plugin works using javascript.
>
> Any ideas?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.