this:

   FORM.accepts(form, request.vars):

should be

   SQLFORM.accepts(form,request.post_vars, session)

or better

   form.accepts(request.post_vars, session)

or eve better

   form.process()


On Thursday, 26 June 2014 18:24:27 UTC-5, haj...@byteplus.com.ng wrote:
>
>
> Pls can someone help here. Am new to web2py. I produce a form using 
> SQLFORM with a submit button. After filling the form and clicking submit, i 
> discoverd the values in the form are not saved into the database. I login 
> using the appadmin, i could create and insert into the database. I will 
> like to know what am doin wrong.
>
> my code snippet:
>
> @auth.requires_login()
> def add_subject():
>     form = SQLFORM(db.subject_result, ignore_rw=True)
>     
>     if FORM.accepts(form, request.vars):
>
>         #session.form_vars = request.vars
>         response.flash = 'Subject Saved'
>         #db.commit() if i comment this out the same thing happen.
>       
>      
>     elif form.errors:
>         response.flash = 'form has errors'
>     else:
>         response.flash = 'fill the form'
>         
>         
>     records = db().select(db.subject_result.ALL)
>     
>     return dict(form=form, records=records)
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to