HI Every one ,
Why show_if validation does't work with SQLFORM.factory(). Here is the
one example , please provide the solution.
Model
db.define_table('client',
Field('name'))
db.define_table('address',
Field('client',db.client,writable=False,readable=False),
Field('street'),Field('city'))
db.define_table('purchase',
Field('have_coupon','string',requires=IS_IN_SET(('Corporate','Individual'))),
Field('coupon_code'))
Controller
def register():
db.purchase.coupon_code.show_if = (db.purchase.have_coupon==True)
form=SQLFORM.factory(db.client,db.address,db.purchase)
if form.accepts(request.vars):
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.