> db[table].navID.widget = lambda f, v: SQLFORM.widgets.options.widget(f, v, 
> _disabled=True)
>
> This solves the valiadtion issue, however, it renders the drop down 
> without the form-control selector:
>
> <select id="nav_vertex_nav_navID" class="generic_widget" name=navID" 
> disabled=disabled>
>
> whereas it should be rendered :
>
> <select id="nav_vertex_nav_navID" class="generic_widget form-control" 
> name=navID" disabled=disabled>
>

Can't you just do:

SQLFORM.widgets.options.widget(f, v, _disabled=True, _class='generic_widget 
form-control')


On this field:
>
> Field('navID', 'reference nav_nav', default='', ondelete='CASCADE', 
> notnull=True, widget=SQLFORM.widgets.options.widget)
>
> Since the field is disabled in the form I could replace it with:
>
> db[table].navID.requires = IS_IN_DB(db, 'nav_nav.id', '%(id)s %(name)s', 
> something = lambda do something)
>
> don't I? I wasn't able to figure out how to code the lambda ....
>

The fourth argument to IS_IN_DB is the error message, so a lambda wouldn't 
go there. Perhaps you meant for that to be in place of the third argument, 
which is for the labels. But what is wrong with the current "labels" 
argument -- does it not produce the labels you want?

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.

Reply via email to