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):
del request.vars.button
...update/insert logic...
On Feb 16, 2:18 pm, reyelts <[email protected]> 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. But the sql on the form.accepts path craps
> out:
>
> S'Traceback (most recent call last):\n File "gluon/restricted.py",
> line 173, in restricted\n File "w:\\web2py_win\\applications\
> \canyonezt/controllers/default.py", line 184, in <module>\n File
> "gluon/globals.py", line 96, in <lambda>\n File "gluon/tools.py",
> line 1851, in f\n File "w:\\web2py_win\\applications\\canyonezt/
> controllers/default.py", line 152, in profile\n File "gluon/sql.py",
> line 1877, in insert\n File "gluon/sql.py", line 1845, in _insert
> \nSyntaxError: invalid field names: [\'button\']\n'
>
> It looks like the DAL is trying to store 'button' in my data base,
> though it is unclear to me why. What's the secret, here?
--
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.