I think I've seen how to do this, but I can't find it again.
Using SQLFORM, I want to limit the the items that appear in reference
pulldown to those that apply to the item on the form.
In the models I have
db.define_table('products',
Field('name'),
format='%(name)')
db.define_table('suppliers',
Field('name'),
format='%(name)')
db.define_table('product_suppliers',
Field('product_id', db.products),
Field('supplier_id, db.suppliers))
db.define_table('purchase_orders'
Field('po_number'),
Field('supplier', db.suppliers))
db.purchase_orders.supplier.requires = IS_IN_DB(db, db.suppliers.id, '%
(name)s', zero='Choice required')
When I create a new purchase order, vars['product_id'] contains the id
of the product. So I can get the suppliers who carry the product
through the product_suppliers table.
I want to make SQLFORM limit the supplier pulldown to those suppliers
that carry the product.
How do I do this?
Thanks