Hi all,
I have a SQLFORM with an onvalidation on the form.accepts(), but it's not
working. It skips the onvalidation function...
Here is what i try (or just like it):
def my_form_processing(form):
c = form.vars.a * form.vars.b
if c < 0:
form.errors.b = 'a*b cannot be negative'
else:
form.vars.c = c
def insert_numbers():
form = SQLFORM(db.numbers)
if form.process(onvalidation=my_form_processing).accepted:
session.flash = 'record inserted'
redirect(URL())
return dict(form=form)
But i'm not getting in the 'function my_form_processing'. When i change the
onvalidation to: 'onvalidation=my_form_processing()' and i remove the
'form' in 'def my_form_processing(form)' i do get into the function, but
then i don't have the form vars that i need to process.
Can this be a bug in Web2py? I'm using version
2.7.4-stable+timestamp.2013.10.14.15.16.29
Thanks in advance!
Remco
--
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/groups/opt_out.