form = SQLFORM(...)
if form.accepts(request.vars, session):
....things to do when form is valid
elif form.errors:
....things to do when form has errors
else:
....things to do when page is loaded the first time
return dict(form=form)
form = SQLFORM(...)
if form.process().accepted:
....things to do when form is valid
elif form.errors:
....things to do when form has errors
else:
....things to do when page is loaded the first time
return dict(form=form)
On 23 Apr 2014 at 20:59:52, Niphlod (nip...@gmail.com) wrote:
you're doing "all" wrong. Stop copy/pasting for a sec and take a look to docs.....it'll save you from multiple headaches.
Despite my error, isn’t it normal doing some copy-past while giving first steps?
in this case, you're "doing wrong" form processing.
It's eitherform = SQLFORM(...)
if form.accepts(request.vars, session):
....things to do when form is valid
elif form.errors:
....things to do when form has errors
else:
....things to do when page is loaded the first time
return dict(form=form)
or (newer)form = SQLFORM(...)
if form.process().accepted:
....things to do when form is valid
elif form.errors:
....things to do when form has errors
else:
....things to do when page is loaded the first time
return dict(form=form)
--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Niphold,many thanks for your reply and valuable tips.On 23 Apr 2014 at 20:59:52, Niphlod (nip...@gmail.com) wrote:
you're doing "all" wrong. Stop copy/pasting for a sec and take a look to docs.....it'll save you from multiple headaches.Despite my error, isn’t it normal doing some copy-past while giving first steps?
I’ve changed the code to this last newer form and it is working fine.Yes It makes sense but I think what confuses me most is the ‘so many ways to do it’.Meanwhile, looking here http://web2py.com/books/default/chapter/29/07/forms-and-validators I can’t figure where is the newer or ‘older’ version.
On Wednesday, April 23, 2014 10:53:01 PM UTC+2, ureal frank wrote:Hi Niphold,many thanks for your reply and valuable tips.On 23 Apr 2014 at 20:59:52, Niphlod (nip...@gmail.com) wrote:
you're doing "all" wrong. Stop copy/pasting for a sec and take a look to docs.....it'll save you from multiple headaches.Despite my error, isn’t it normal doing some copy-past while giving first steps?
For some peoples, apparently : I'm just saying that you'll save headaches NOT copy/pasting :P
web2py stack is huge. the documentation is also huge and detailed.
this is great but for newbies this is massive :)
hey this is not an escuse, I have too many things to learn and I am loving it.
I’ve changed the code to this last newer form and it is working fine.Yes It makes sense but I think what confuses me most is the ‘so many ways to do it’.Meanwhile, looking here http://web2py.com/books/default/chapter/29/07/forms-and-validators I can’t figure where is the newer or ‘older’ version.It's the first section on FORM and SQLFORM :D
Oh I see… I was understanding it wrong…
I though that in the handbook I would read a bold ‘deprecated’ vs ‘new way of doing things’.
Once again many thanks for your help and time :)
Regards,
Frank