db.define_table('t_prospects',
Field('f_account', db.t_accounts, required=True,
label=T('Account')),
Field('f_project', db.t_projects, required=True,
label=T('Project')),
Field('f_keypersons', type='list:reference t_contacts', requires=IS_IN_DB(db, 't_contacts.id', '%(f_name)s'),
label=T('Key Person')),
auth.signature,
format='%(f_account)s',
migrate=settings.migrate)
db.t_prospects.f_account.requries = [IS_NOT_EMPTY(), IS_IN_DB(db, 't_accounts.id', '%(f_name)s')]
db.t_prospects.f_project.requries = [IS_NOT_EMPTY(), IS_IN_DB(db, 't_projects.id', '%(f_project)s')]db.define_table('t_contacts',
Field('f_name', type='string', required=True,
label=T('Name')),
Field('f_tel1', type='string',
label=T('Telephone 1')),
Field('f_tel2', type='string',
label=T('Telephone 2')),
Field('f_fax', type='string',
label=T('Fax')),
Field('f_mobile', type='string',
label=T('Mobile')),
Field('f_email1', type='string',
label=T('Email 1')),
Field('f_email2', type='string',
label=T('Email 2')),
Field('f_remarks', type='list:string',
label=T('Remarks')),
auth.signature,
format='%(f_name)s',
migrate=settings.migrate)
db.t_contacts.f_name.requires=IS_NOT_EMPTY()Field('f_keypersons', type='list:reference t_contacts', requires=IS_IN_DB(db, 't_contacts.id', '%(f_name)s'),

--
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/zZ7LHTCcUUA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I read in the book that "requires' will be set by default for "list:reference". I tried this, and the output is the same as with IS_IN_DB(..., multiple=True), which is a multiple item box listing all options as shown in the pic below:


Anthony--
The intention is to create a list of items each of which are selected from the dropdown of referenced table, similar to 'list:string' with a "+/-" sign at the end to add another item. When click the "+/-" sign it pops another dropdown list to add new item. I photoshoped the pic below to show what I want:
By checking database records I realized that all "list" fields even in other tables cannot be modify by length any more. Below is a pic of db management in Appadmin. No "+/-" sign. Don't know what went wrong..
Anthony--