My previous answer was too short. I was in a hurry. So I want elaborate it 
more.
Martin wrote to have an alignment problem between the label and the text 
that SQLFORM generates when the field is not writable.
Web2py in this context gives to the label of not writable field the css 
class "readonly" that not to be confused with the homonym html attribute.
bootstrap gives a padding-top 7 px to the label in a horizontal form and, 
in the case of a static control, suggests

*When you need to place plain text form next to a label within at form, use 
> the .form-control-static class on a <p>.*


Therefore, in order to align the text to its label we could wrap the text 
in a <p> tag (maybe using javascript) having "form-control-static" class or 
assign a top padding of 7 px to the <div> that is sibling of the label in 
the rendered SQLForm

label.readonly ~ div {padding-top: 7px;}

of course the previous css rule goes in an extra .css file after bootstrap 
files.



Il giorno lunedì 21 novembre 2016 16:42:54 UTC+1, Martin de Groot ha 
scritto:
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to