You cannot call both process() and accepts. You do not need to call insert.
it is automatic for SQLFORMS.
you want this:
form = SQLFORM(test.new_form).process()
if form.accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
The view you posted is not for this action.
On Friday, 27 June 2014 14:02:39 UTC-5, Maria Levchenko wrote:
>
>
> Could you please help me?
>
> I have a table in database (new_form) and a form for it with selector.
> After submit an answer database doesn't change.
> What am i doing wrong?
>
> in database:
>
> test.define_table('new_form',
> Field('omonim', 'list:string'))
>
> In controller:
>
> form = SQLFORM(test.new_form).process()
> if form.accepts(request.vars, session):
> test.new_form.insert(form.vars.omonim)
> response.flash = 'form accepted'
> elif form.errors:
> response.flash = 'form has errors'
>
> In view:
>
> <form action="#" enctype="multipart/form-data" method="post">
> <select> {{for forms in formses1[n]:}}
> <option name=omonim>{{=forms}}</option>{{pass}}
> </select> <input type="submit"/></form>
>
> Page view: https://concordance.pythonanywhere.com/test/default/morpho/6
>
> Are there any chance for making only one button "submit" for several
> fields?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.