How to assign a value to an SQLFORM

36 views
Skip to first unread message

Robin Manoli

unread,
Dec 4, 2016, 4:37:37 AM12/4/16
to web2py-users
Hi!

Is it possible to set values to be inserted/updated to fields in an SQLFORM programatically?

The documentation (http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-method) says:
However, if you assign a value to form.vars.field, this value will be part of the insert or update when the form is processed. This enables you to change the value of fields that for some reason you do not wish to include in a form.

The question is where do I access this variable form? I have tried both after form = SQLFORM... and after form.process()...and even in the onvalidation function... but I can't see the fields being updated. Furthermore: how can I update a list:reference in this way?

Note, I would like to do this specifically for the instance of the SQLFORM rather than using the database before_insert/update lists.

Robin Manoli

unread,
Dec 4, 2016, 6:12:47 AM12/4/16
to web2py-users

Pierre

unread,
Dec 4, 2016, 11:14:21 AM12/4/16
to web2py-users
Reply all
Reply to author
Forward
0 new messages