Cut and paste from the book : When a field is marked with writable=False, the field is not shown in create forms, and it is shown readonly in update forms. If a field is marked aswritable=False and readable=False, then the field is not shown at all, not even in update forms.
Forms created with form = SQLFORM(...,ignore_rw=True) ignore the readable and writable attributes and always show all fields. Forms in appadmin ignore them by default. Forms created with form = SQLFORM(table,record_id,readonly=True) always show all fields in readonly mode, and they cannot be accepted. Marking a field with writable=False prevents the field from being part of the form, and causes the form processing to disregard the value of request.vars.field when processing the form. 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. http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=readable#SQLFORM-and-insert/update/delete Not sure I understand what you want to say here : "shows the val_formação label only, no input text" In a update form, according to the behavior explained above you should not be able to enter any data into the field. And if you want to remove the label too, you have to put readable=False also... If you want the field to be in readonly mode in update form, you have to set readonly=True in your SQLFORM() sentence. Richard On Tue, Sep 3, 2013 at 11:47 AM, António Ramos <ramstei...@gmail.com> wrote: > hello my code > > > > if not auth.has_membership('admin'): > * db.trabalhador.val_formacao.writable=False* > > form=SQLFORM(db.trabalhador,row.id, > showid=False, > submit_button="Gravar", > > fields=['nome','bi','ncart','ncartval','rfid','apt_medica','apt_medicaval', > *'val_formacao*','area','obs'], > table_name='trabalhador', > formstyle = 'table2cols', > upload=URL('download') > ) > > > > shows the val_formação label only, no input text > > however if i change the line to > > *db.trabalhador.val_formacao.writable=False* > *db.trabalhador.val_formacao.readable=False** > * > * > * > I get the label and the input text > > why? > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.