One more try -- see if request.vars.delete_this_record works. If not, add request.toolbar() to the page and inspect request.vars to see all the variable names (don't do a redirect).
Anthony On Saturday, March 3, 2012 3:52:50 PM UTC-5, HittingSmoke wrote: > > Somehow it's still not catching it. > > I edited the function a bit to make sure it wasn't just an issue with > my URL syntax but I'm still being redirected to the nonexistent post > view page: > > def edit(): > postid = request.args(0) > post = db(db.blogPost.id == postid).select()[0] > editBlog = SQLFORM(db.blogPost, post, deletable=True) > if editBlog.process().accepted: > if request.vars.delete_record: > response.flash = 'Post deleted' > else: > redirect(URL(f="view", args=editBlog.vars.id)) > return dict(editBlog=editBlog, post=post) > > Thanks for the help, btw. > > On Mar 3, 11:44 am, Bruno Rocha <[email protected]> wrote: > > Sorry, the correct is delete_record > > > > def edit(): > > postid = request.args(0) > > post = db(db.blogPost.id <http://db.blogpost.id/> == > postid).select()[0] > > editBlog = SQLFORM(db.blogPost, post, deletable=True) > > if editBlog.process().accepted: > > if request.vars.*delete_record:* > > redirect(URL('index')) > > else: > > redirect(URL(f="view", > > args=editBlog.vars.id<http://editblog.vars.id/> > > )) > > return dict(editBlog=editBlog, post=post) > > > > > > > > > > > > > > > > > > > > On Sat, Mar 3, 2012 at 4:35 PM, HittingSmoke <[email protected]> > wrote: > > > I'm having a problem, probably due to my noobishness. This is my edit > > > function: > > > > > def edit(): > > > postid = request.args(0) > > > post = db(db.blogPost.id == postid).select()[0] > > > editBlog = SQLFORM(db.blogPost, post, deletable=True) > > > if editBlog.process().accepted: > > > if request.vars.delete: > > > redirect(URL('index')) > > > else: > > > redirect(URL(f="view", args=editBlog.vars.id)) > > > return dict(editBlog=editBlog, post=post) > > > > > It's not redirecting on delete. It's still trying to redirct to the > > > newly nonexistent post. > > > > > On Mar 3, 12:25 am, Bruno Rocha <[email protected]> wrote: > > > > if form.process().accepted: > > > > if request.vars.delete: > > > > redirect(URL('index')) > > > > > > On Sat, Mar 3, 2012 at 4:41 AM, HittingSmoke <[email protected]> > > > > wrote: > > > > > I created a very simple blog and when done editing a post, I am > > > > > redirected to the updated post. > > > > > > > This works great unless I'm deleting a post, in which case it > spits > > > > > out an error because the post no longer exists. > > > > > > > How can I tell my controller to check the status of the deleted > > > > > checkbox before submitting a form update? > > > > > > -- > > > > > > Bruno Rocha > > > > [http://rochacbruno.com.br] > > > > -- > > > > Bruno Rocha > > [http://rochacbruno.com.br]

