def redirect_parent(url):
def tmp(form):
response.headers['web2py-component-
command']="document.location='%s'" % url
raise HTTP(200)
return tmp
def edit_method():
if not request.args:
return dict(form = crud.create(db_method), method = None)
method = db(db_method.id == int(request.args(0))).select().first()
form = crud.update(db_method,
method,onaccept=redirect_parent(URL(.....)) #<<<<<
return dict(form = form, method = method)
On Feb 19, 4:53 am, selecta <[email protected]> wrote:
> how can I tell crud to redirect to an url that displays the created
> item (of course only on successful creations)
>
> my controller looks like that
>
> def edit_method():
> if not request.args:
> return dict(form = crud.create(db_method), method = None)
> #something with next/onvalidate/... here?
> method = db(db_method.id == int(request.args(0))).select().first()
> form = crud.update(db_method, method)
> return dict(form = form, method = method)
>
> in the view i use LOAD and method to get some other stuff
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.