When I used the second choice, I got the following Traceback: Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.
Traceback (most recent call last): File "/Users/SR/Documents/web2py/gluon/restricted.py", line 227, in restricted exec ccode in environment File "/Users/SR/Documents/web2py/applications/myapp/controllers/events.py" <http://127.0.0.1:8000/admin/default/edit/ncmi/controllers/events.py>, line 417, in <module> File "/Users/SR/Documents/web2py/gluon/globals.py", line 417, in <lambda> self._caller = lambda f: f() File "/Users/SR/Documents/web2py/gluon/tools.py", line 4241, in f return action(*a, **b) File "/Users/SR/Documents/web2py/applications/myapp/controllers/events.py" <http://127.0.0.1:8000/admin/default/edit/ncmi/controllers/events.py>, line 220, in register_workshop fields =['title','help2']) File "/Users/SR/Documents/web2py/gluon/sqlhtml.py", line 1288, in __init__ inp = self.widgets.boolean.widget(field, default) File "/Users/SR/Documents/web2py/gluon/sqlhtml.py", line 278, in widget **attributes) File "/Users/SR/Documents/web2py/gluon/sqlhtml.py", line 160, in _attributes trigger, cond = show_if(field.show_if) File "/Users/SR/Documents/web2py/gluon/sqlhtml.py", line 112, in show_if base = "%s_%s" % (cond.first.tablename, cond.first.name) AttributeError: 'Query' object has no attribute 'tablename' On Sunday, July 24, 2016 at 5:32:43 PM UTC-5, Sneka R wrote: > > Can I use show_if for 2 tables? > For example: > db.table2.field.show_if = (db.table1.box==True) > > To be more clear: > Model: > db.define_table(’table1’, > Field('title’,label=‘Workshop title > :',requires=IS_NOT_EMPTY()), > Field(’help1’,’boolean’,label=’Need help?’)) > > > db.define_table(’table2', > Field(’title', 'reference table1',label='Workshop title > :'), > Field(‘help2’,’boolean’, label=’Need help?')) > > Controller: > def register_workshop(): > workshop = db.table1(request.args(0)) > db.table2.help2.show_if = (db.table1.help1==True) > -- 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.