When you set writable=False, web2py does not disable the form input 
element, but instead just writes the value in place of the input element. 
Instead, you can leave writable=True and manually set the select widget to 
be disabled:

db.mytable.myfield.widget = lambda f, v: SQLFORM.widgets.options.widget(f, v
, _disabled=True)

However, if the built-in Bootstrap formstyle is not displaying read-only 
values nicely, you should submit a Github issue so it can be improved.

Anthony


On Wednesday, July 15, 2015 at 7:41:26 AM UTC-4, Annet wrote:
>
> When I set writable = False on a field that is being rendered as a select
> it does not comply with Bootstraps disabled state for disabled selects:
>
> http://getbootstrap.com/css/#forms-control-disabled
>
> <div class="form-group">
>   <label for="disabledSelect">Disabled select menu</label>
>   <select id="disabledSelect" class="form-control">
>     <option>Disabled select</option>
>   </select></div>
>
>
> What I get instead is:
>
> <div id="nav_vertex_navID__row" class="form-group">
>   <label id="nav_vertex_navID__label" class="control-label" 
>     for="nav_vertex_navID">Disabled select menu</label>
>     Disabled select</div>
>
>
> which does look rather ugly. Is it possible ti fix this issue?
>
>
> Kind regards,
>
> Annet
>

-- 
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.

Reply via email to