Have you thought about maybe looking into the AJAX calls that are
available?  That way, the page won't postback.  You can call a
controller to do whatever you need with the data from the form.

Otherwise, I can't see an easy way without somehow saving the state of
where the page was called from (menu or view).  In which case you can
try the query string parameter, hidden variable, or session variable.

Hope this helps!

On Aug 23, 9:44 am, "david.waldrop" <david.wald...@gmail.com> wrote:
> I have a basic update form code that is called via a HREF form another
> view and form a menu.  The problem is the redirect to the referrer is
> not working.  I looked in the forums and have tried to debug.  I
> understand the form is posting back to itself which is why the form is
> redirected to itself.  The forums offer several solutions that depend
> on a hidden form element embedded in the calling view which are save
> as request.vars.  I am not sure how to make this work with a menu.  I
> hope there is a clean elegant way to accomplish this.  Any help would
> be apprecaited..
>
> @auth.requires_login()
> def editmeeting():
>     if not request.args:
>         session.flash = 'Invalid parameter'
>         redirect(URL(r=request, c='default',
> f='index'))
>     meeting = db(db.meeting.id == request.args(0)).select()
>     if len(meeting):
>         meeting = meeting[0]
>     else:
>         session.flash = 'Invalid meeting'
>         redirect(URL(r=request,c='default',f='index'))
>     form=SQLFORM(db.meeting,meeting, submit_button='Update Meeting')
>     if form.accepts(request.vars, session):
>         redirect(request.env.http_referer)
>     elif form.errors:
>         response.flash = 'Invalid data.'
>     return dict(form=form)

Reply via email to