[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-13 Thread Massimo Di Pierro
please submit a bug report and we'll fix it. On Saturday, 12 July 2014 13:02:45 UTC-5, Louis Amon wrote: > > Not sure if somebody noticed before, but the show_if syntax (backed by > web2py.js) is actually breaking if you use SQLFORM.factory to generate your > form. > > > Example: > > db.define_t

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Anthony
Sure. Note, you don't need to replace the whole widget -- just update the attribute directly: form.element('input', _id='%s_%s' % (table_name, field.name)).update( data={'show-trigger': '%s_%s' % (table_name, field.show_if.first.name)}) Anthony On Saturday, July 12, 2014 4:38:58 PM UTC-4, L

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Louis Amon
I think a framework like web2py shouldn't break by default, and work only if you know which parameter to set. Anyway here's a better example: db.define_table('person', Field('name')) db.define_table('other', Field('show_trigger', 'boolean')) db.person.name.show_if = (db.other.show_trigger ==

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Anthony
Instead, you can just do this: form = SQLFORM.factory(db.person, table_name='person') Anthony On Saturday, July 12, 2014 2:02:45 PM UTC-4, Louis Amon wrote: > > Not sure if somebody noticed before, but the show_if syntax (backed by > web2py.js) is actually breaking if you use SQLFORM.factory to