you need to hook up to the submit event of the form and disabling what you
added as onbeforeunload.
Lots of examples around, e.g.
http://stackoverflow.com/questions/1973708/how-to-prevent-onbeforeunload-from-being-called-when-clicking-submit-button
On Tuesday, August 6, 2013 8:54:15 PM UTC+2, Antonis Konstantinos Tzorvas
wrote:
>
> def add():
> form = SQLFORM.factory(Field('url', 'string'))
>
> if form.process().accepted:
> mystation = info.station(form.vars.url)
> session.tmpstation = mystation
> redirect(URL('confirm'))
> return dict(form=form)
>
>
> def confirm():
> ... prepopulating form with vars from vars(session.tmpstation) ...
> form = SQLFORM(db.stations).process(next=URL('populate'),
> message=T("record created"))
> del session.tmpstation
> return dict(form=form)
>
> .... confirm.html
> {{extend 'layout.html'}}
> {{=form}}
> <script>window.onbeforeunload = function() {return "form will lose all
> data";};</script>
>
> is there any way to prevent onbeforeunload if form.submit() is the event
> triggering the "onbeforeunload"?
>
--
---
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/groups/opt_out.