Hi Ed,

you can set the readable and writable flags of the field on the fly in
the action, just before you call SQLFORM:

def action():
  db.table.field.writable = False
  form=SQLFORM(...)
  ...

On Feb 16, 6: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

Reply via email to