[web2py] Re: SQLFORM.widgets.options.widget(f, v, _disabled=True)

2015-07-29 Thread Annet
Hi Anthony, Can't you just do: > > SQLFORM.widgets.options.widget(f, v, _disabled=True, _class='generic_widget > form-control') > > Yes , that solves the issue, thanks. > > 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

[web2py] Re: SQLFORM.widgets.options.widget(f, v, _disabled=True)

2015-07-28 Thread Anthony
> 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: > > disabled=disabled> > > whereas it should be rendered : > > name=navID" disabled=disab

[web2py] Re: SQLFORM.widgets.options.widget(f, v, _disabled=True)

2015-07-28 Thread Annet
Hi Anthony, Thanks for your reply. I changed my code to: db[table].navID.widget = lambda f, v: SQLFORM.widgets.options.widget(f, v, _disabled=True) ... form = SQLFORM(table, record, deletable=deletable, showid=False) request.post_vars.navID = record.navID This solves the valiadtion issue, how

[web2py] Re: SQLFORM.widgets.options.widget(f, v, _disabled=True)

2015-07-26 Thread Anthony
When you disable a field in HTML, the browser does not submit a value for it. However, SQLFORM is still expecting a value (it doesn't know you disabled the field, so doesn't treat it as a readonly field). You could add the field's default value to request.post_vars before form processing, or yo