Try:

db.table1.order.show_if = db.table1.colour.belongs(['red', 'blue'])

Anthony

On Tuesday, June 2, 2015 at 6:09:20 AM UTC-4, kecajkecaj...@gmail.com wrote:
>
> Hi, 
>
> I'm using show_if to hide a filed of my form under certain conditions.
> Per web2py guide, show_if uses simple query, but it doesn't work for 
> logical oprators like "and" "or".
> In below example i would like to display field "order" just when colour is 
> set to "blue" or "red".
>
> db.define_table('table1', Field('colour', 
> requires=IS_IN_SET(['blue','red','yellow'])), Field('order'))
>
> ## That works fine
> db.table1.order.show_if = (db.table1.colour=='red')
>
> #that doesn't work returning error " 'Query' object has no attribute 
> 'tablename'"
> db.table1.order.show_if = (db.table1.colour=='red') | 
> (db.table1.colour=='blue')
>
> form=SQLFORM(db.table1)
>
>
> Any ideas?
>
> Also is it possible to use show_if with SQLFORM.factory ? I don't need 
> database for that form, but i want to use show_if.
>
> Thanks.
>

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