FORM other then process & errors

35 views
Skip to first unread message

lucas

unread,
May 12, 2019, 3:58:22 PM5/12/19
to web2py-users
hey one and all,

ok, I have standard code under my controller like:

gfrm = FORM(db.table1, recode=id)
if gfrm.process(onvalidate=chk_ok).accepted:
   
#lots of stuff
    session
.flash = 'Successfully Generated Tests'
    redirect
(URL('tests'))
elif gfrm.errors:
    response
.flash = 'Generated Tests Errors'
else:
    response
.flash = 'ok'


I believe I learned that there are only the process-accepted and errors sections.  but I have a condition where its going under the else section where ok is.  what are the causes of a FORM going into that area?

thank you in advance, Lucas

villas

unread,
May 16, 2019, 7:48:11 AM5/16/19
to web2py-users
It is probably clearer if you edit the code to read:

   else:
       response.flash = 'please fill out the form'

In other words, this section is used when the form is not posted to the function, like when you first access it.

lucas

unread,
May 16, 2019, 10:54:39 AM5/16/19
to web2py-users
that is true and I've done that as a matter of routine.  I believe I fixed the problem when I added formname='such and such' under germ.process(formname='such and such',onvalidate=chk_ok).accepted because I literally had 12 forms on this one page and I believe I mistakenly used gfrm twice.  so I renamed one of the gfrm in code and then added the forename under all of the form process es just to solidify it down.  thank you for your help.  Lucas
Reply all
Reply to author
Forward
0 new messages