Yes- it looks very bad. I think the below method will work. (Let me know if
you need any elaboration)
rofields = [db.<table>.field1, .....]
hidden = {}
for f in rofields:
fname = str(f).split('.')[1]
hidden[fname] = r[fname]
form1 = SQLFORM(db.<table>, record=<recid> , showid=True, hidden=hidden)
for f in rofields:
fname = str(f).split('.')[1]
try:
form1.element('input', _name=fname)['_disabled'] = 'true'
except:
pass
try:
form1.element('textarea', _name=fname)['_disabled'] = 'true'
except:
pass
try:
form1.element('select', _name=fname)['_disabled'] = 'true'
except:
pass
-----------------------------------------------------------------------------------------------------------------------------------------------
On Monday, November 21, 2016 at 9:12:54 PM UTC+5:30, Martin de Groot wrote:
>
> In a SQLForm all widget-controls of writable fields are nicely, correctly
> vertically aligned with the preceding label.
>
> However, when one adds db.table.field.writable = False in the
> contrller-action function the widget-control is correctly changed from an
> input control to a read-only control, but the text of the field's value is
> placed noticeably higher than the text of the preceding label.
>
> I have been looking into the html source code of the resulting page, to
> see if I could figure out which style I could apply in an extra .css file
> statement, but I cannot find anything.
>
> I am sure many other users have observed this vertical alignment being too
> high , especially if the text in the field is just on one line.
>
> I would very much appreciate it if anyone can suggest a solution for this.
> Apart from making a custom form, which is a lot more work than using the
> SQLForm generated code.
>
> Martin de Groot
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.