Non-Editable field in SQLFORM

43 views
Skip to first unread message

Amit Kumar Modak

unread,
Dec 9, 2016, 10:38:55 AM12/9/16
to web2py-users
Hello,

How can I make a field non-editable in SQLFORM, while it should be allowed to take a value in insert.


Regards,
Amit

Massimo Di Pierro

unread,
Dec 11, 2016, 8:45:23 PM12/11/16
to web2py-users
This is an XY question. Can you explain your user case?

lyn2py

unread,
Dec 12, 2016, 11:17:25 AM12/12/16
to web2py-users
It will always be allowed to take a value in insert, a value that you assign it to, for example, via "default", like so:
db.table.field.default = some_value

To make the field non-editable to the end user, use:
db.table.field.editable = False
...
form
= SQLFORM(db.table)

for the above examples, replace table with your table name and field with your field name.

You can find out the details in Chapter in 06 The database abstraction layer and 07 Forms and validators

Fabiano Almeida

unread,
Dec 12, 2016, 11:28:13 AM12/12/16
to web...@googlegroups.com
db.table.field.writable = False -> don't write
db.table.field.readable = False  -> don't show (hide)

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages