if it's checked the corresponding var would be True. 
If the form is submitted the controller will receive that field as 
request.vars.fieldname or as form.vars.fieldname if you are using a form. 
When you "get to" the form.process() line the value has been already been 
"shipped" to the database. You must act "before": there is the onvalidation 
callback (but it's generally used for other things, like additional 
validation).

If you want to skip form processing at all (and possibly doing some other 
custom logic) you can rely either on SQLFORM with process(dbio=False) or 
with SQLFORM.factory..... in either case you'll have to build (or not, 
depending on the checkbox) the corresponding create/update record "by hand" 
(not so hard with e.g. SQLFORM.factory because generally your form.vars 
would be ready to be inserted into the table if the form has the same 
structure of the table itself, e.g. db.table.insert(**form.vars))


On Monday, December 3, 2012 3:27:29 PM UTC+1, Daniele wrote:
>
> Hey guys, I'm wondering if there's a way from the controller to know 
> whether a form's boolean field (checkbox) is selected or not. I only want 
> to add the info in the form to the database if the checkbox is selected, 
> otherwise the controller should not process that form.
>
> Thanks!
>

-- 



Reply via email to