Just specify it explicitly in the function, something like this...
e.g.
def index():
t=db.tablename
rec = t(request.args(0))
t.fieldname.readable = t.fieldname.writable = False
form=SQLFORM(t,rec)
if form.accepts(request.vars, session):
response.flash = 'record accepted'
-D
On Feb 16, 11:57 pm, Ed Greenberg <[email protected]> wrote:
> I'd like to suppress some fields in a SQLFORM.
>
> Imagine that a user is filling out a form to create or edit a record,
> and his user_id is a column in the record. We need to populate the
> user_id, but he should never see it.
>
> If I declare the field as writable=False,readable=False then nobody
> with more privilege could ever use a SQLFORM (or crud.create,
> crud.update, etc) to access the field. I need it suppressed just in
> certain instances.
>
> Also, if the SQLFORM accepts, web2py needs to know what to put in that
> field.
>
> Should I retire SQLFORM and use a FORM, or is there some magic I can
> use to accomplish this.
>
> I want to say I appreciate all this help. Thanks, Massimo and all.
>
> Ed Greenbeg