That kind of thing has to be done via Javascript on the client side. For 
some references, see 
http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
.

Anthony

On Saturday, August 25, 2012 5:34:14 PM UTC-4, SeamusSeamus wrote:
>
> Right now I am categorizing my products by 'category' and 'subcategory' 
> using smartgrid. This makes it very easy for me to log in and set my cats 
> and sub cats. I have two tables below. 
>
> db.define_table('cat',
>     Field('name'),
>     format = '%(name)s'
>     )
>
> db.define_table('subcat',
>     Field('cat', 'reference cat'),
>     Field('name'),
>     format = '%(name)s'
>     )
>
>  I also have a third table for the product:
>
> db.define_table('equipment',
> ...
>     Field('category', db.cat),
>     Field('subcategory', db.subcat, label="Sub-Category")
> ...
> )
>
> I am using this as my controller:
>
> def productadmin():
>
>     fields = [db.equipment.title, db.equipment.approved]
>
>     grid = SQLFORM.grid(db.equipment, fields=fields)
>
>     return dict(grid=grid)
>
>
> Here is my question.
>  When I click on 'edit' in the sqlform.grid for an item, and I want to 
> change the category or assign the category, how do I make it so only the 
> subcat will show if it is truly a subcat for the category? Currently, I 
> have a list of all my cats and a list of all my subcats.
>
>
>

-- 



Reply via email to