i usually hard-code where i want the form to go after accept, but it
sounds like this does not work for you.

what about appending a var to the url that is where to go after:

http://foo.com/app/meetings/editmeeting/123?redir=app/home

would that work for you? (i have not tested if the var persists past
the form submit though, just a thought.

good luck,

cfh

On Aug 23, 7:44 am, "david.waldrop" <[email protected]> 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