On Jul 24, 1:35am, weheh <[email protected]> wrote:
> Pardon, professor, but my dog ate my reading assignment on virtual
> fields and I couldn't find it in the documentation. I've seen a few
> threads on the topic, but none that fully described what it is.
> Compute fields were also consumed by the mutt. Could you tell us where
> to find doc on these constructs?

First of all, I am not the professor, but I thank you for your
actually supporting my point that these two features are so
unpopular. :-)

These two features are undocemented in web2py.com/book. When I said I
need to check document, I just mean reading my personal notes about
them. Here it is.

rows.setvirtualfields(...)
        
https://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
and it only works when retrieving records from db.

At the same time:
        Field('bar', compute=lambda r:r['foo']) # not r.foo
is an easier equivalent for:
        def callback(form): form.vars.bar = form.vars.foo
        form.accepts(..., onvalidation=callback)
and it only works before inserting or updating a record into db.

Regards,
Iceberg

Reply via email to