> > I don't see any advantage in using the fields parameter because the change > I found > form.element('#no_table_sn')['_readonly'] = 'readonly' > and the suggestion you made > widget=lambda f, v: SQLFORM.widgets.string.widget(f, v, _readonly=True) > only change 1 line, and using the fields would make me change all the > Fields lines (if I'm not mistaken). >
No, "fields" is an argument of SQLFORM: form = SQLFORM.factory(..., fields=['field1', 'field2', ...]) Anyway, setting the _readonly attribute of the input widget and setting writable=False in the Field() definition do two different things. The former makes the input element read-only in the UI but is less secure because it does not prevent writes on the server. The latter does not use an input element to display the data in the UI, and it also prevents writes on the server. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.