On Thursday, May 31, 2018 at 2:27:44 PM UTC-4, Andrea Fae' wrote:
>
> thanks Anthony. Could you give me simple example about second idea? It's 
> noy possible to pass variables to a onvalidation funtion? i.e. onvalidation 
> doesn't accept parameters...the problem is: how to make that object 
> available to the onvalidation function?
>

    record = db.mytable(1)

    def my_validation(form):
        [now access record, which has been defined in the parent scope]

    form =SQLFORM(...).process(onvalidation=my_validation)

or:

    record = db.mytable(1)

    def my_validation(form, record):
        ...

    form = SQLFORM(...).process(onvalidation=lambda form: my_validation(form
, record))

Anthony

-- 
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