On Mar 11, 6:33 am, rif <[email protected]> wrote: > db.define_table('client', > Field('name'), > format='%(name)s' > ) > > db.define_table('project', > Field('client', db.client), > Field('name'), > format='%(name)s' > ) > > db.define_table('entry', > Field('client', db.client), > Field('project', db.project), > Field('name'), > format='%(name)s' > ) > > 1. With the above models how can I make the project field in the entry table > be optional (not required in entry form)?
You could add: db.entry.project.requires=IS_EMPTY_OR(IS_IN_DB(db,db.project.name)) > 2. Is there a recommended way to display only the projects for the selected > client in the entry form? IS_IN_DB's first parameter is a DB Set, so you can do: qry=(db.project.client==theclientid) db.entry.project.requires=IS_IN_DB(db(qry),db.project.name) > Thank you, > rif

