On Feb 16, 2010, at 12:18 PM, reyelts wrote: > I'm trying to use this with my shiny new SQLFORM. But I'm clearly > missing something. Here's a snippet: > > form = SQLFORM(...blah...) > submit = form.element(_type='submit') > > submit.parent.append(INPUT(_type='submit',_value='Cancel',_name='button')) > > if request.vars.button == 'Cancel': > session.flash = 'profile create was cancelled' > session.flash = 'profile update was cancelled' > redirect(URL(r=request,f='index')) > elif form.accepts(request.vars,session,dbio=False): > ...update/insert logic... > > The cancel works perfectly.
A problem that someone mentioned recently (or at least alluded to) is that there's an issue with IE and multiple submit buttons, namely that if the user types a return in a form field, you aren't guaranteed that you'll see the first submit button. So somebody might type a return, and you'll see a cancel. So I ended up with _type='button', and an onclick script to provide the URL. So far so good.... -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.