Thank you very much Bernardo. I'll have a look through that documentation and see what I can put together. Joe
On Nov 21, 5:33 pm, Bernardo Botella Corbí <[email protected]> wrote: > Hi Joe, > > I don't know if I understood well. I think that you are trying to do a drop > list, putting in it the pet_type belonging to an owner? > > In that case, in this > thread:http://groups.google.com/group/web2py/browse_thread/thread/3f2ea9bcd3... > > This need is discussed. I did something similar, and I used the code found > here:http://www.web2pyslices.com/main/slices/take_slice/85<http://www.google.com/url?sa=D&q=http://www.web2pyslices.com/main/sli...> > > (thanks mr.freeze!!) > > kind regards, > Bernardo > > 2010/11/21 Joe J <[email protected]> > > > Hi All, > > Say I have a pet table and an owner table related to each other in a > > one to many relationship (one owner has many pets). Each owner can > > also define several pet types of their choosing. > > > db.create_table('owner', > > Field('name', text)) > > db.create_table('pet_type', > > Field('type_name','text'), > > Field('type_owner',db.owner)) > > db.create_table('pet', > > Field('pet_name', 'text'), > > Field('pet_type'), db.pet_type), > > Field('pet_owner'), db.pet_owner)) > > > How do I create a model validator so that, when adding or editing a > > pet associated with a particular owner, only pet_types "belonging" to > > that owner show up in the form dropdown? (Owners can define their own > > custom pet_types). > > > This rule displays ALL defined pet_types in the pet_type table, and > > not simply the ones owned by a given owner. > > db.pet.pet_type.requires = IS_IN_DB(db, 'pet_type.id', '% > > (type_name)s') > > > Any help is much appreciated. > > Joe > >

