I don't usually use show_if but I'm guessing it's because a db.purchase.have_coupon is not == to True. Which makes sense since it's a string. You can test in the python interpreter 'abc' == True, the result will be False.
The correct form would be: db.purchase.coupon_code.show_if = (db.purchase.have_coupon is not None) That form makes it explicit that you want to show if it's not empty, but you could make it simpler because None evaluates to False. db.purchase.coupon_code.show_if = db.purchase.have_coupon This confusion arises that when evaluating things as booleans python converts any non empty object to True. Another way to write this closer your form would be: db.purchase.coupon_code.show_if = (bool(db.purchase.have_coupon) == True) Which is obviously redundant since you can just do: db.purchase.coupon_code.show_if = bool(db.purchase.have_coupon) But python already does that for you when you will be using that as a condition so you could really just write: db.purchase.coupon_code.show_if = db.purchase.have_coupon And we have gone full circle. I hope it helped. -- 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.