you are welcome!! Richard
On Fri, Mar 27, 2015 at 12:22 PM, LoveWeb2py <[email protected]> wrote: > sigh... so I just realized that the if form.process().accepted actually > processes the form. No words to express my embarrassment right now lol.. > > Thank you for the help, Richard! > > On Friday, March 27, 2015 at 12:10:12 PM UTC-4, Richard wrote: >> >> haha!! >> >> You need to read... >> >> http://web2py.com/books/default/chapter/29/07/forms-and-validators#FORM >> >> Then : >> >> http://web2py.com/books/default/chapter/29/07/forms- >> and-validators#SQLFORM >> >> In particular form processing : >> >> http://web2py.com/books/default/chapter/29/07/forms- >> and-validators#The-process-method >> >> Add this below your form : >> >> if form.process(session=None, formname='test').accepted: >> response.flash = 'form accepted' >> elif form.errors: >> response.flash = 'form has errors' >> else: >> response.flash = 'please fill the form' >> >> >> Also, instead of calling your form "grid" why use missleading variable >> name... Call it "form" >> >> If you keep grid, change the variable name accordingly in the aboce code >> extract from the bookkk >> >> Richard >> >> >> >> On Fri, Mar 27, 2015 at 11:56 AM, LoveWeb2py <[email protected]> wrote: >> >>> Ahhh that makes great sense. Learn something new all the time. Thank >>> you, Richard! >>> >>> right now here is my code: >>> def unique_view(): >>> >>> prefs_id = db(db.unique_view_peruser.auth_user_id == auth.user_id). >>> select(db.unique_view_peruser.id) >>> >>> if len(prefs_id) == 1: >>> prefs_id = prefs_id.id >>> else: >>> prefs_id = None >>> grid = SQLFORM(db.unique_viewperuser, prefs_id) >>> return dict(grid=grid) >>> >>> This does not insert anything into the database >>> Do I need to update the database after SQLFORM? >>> I could use something like db.unique_viewperuser.insert(insert values) >>> if the form is accepted. I thought when SQLFORM goes into create mode it >>> would create the database automatically and insert the values >>> automatically. Am I wrong? >>> >>>> >>>>> >>>> -- >>> 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. >>> >> >> -- > 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. > -- 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.

