Reputation:
Do I need a custom validator? Do I need a custom widget?
If this helps to clear the problem, the relationship is between member
and language
where a member can have multiple languages and a language is spoken by multiple members.
I would like to add a multi-select box in the "add member" form (that I generate using SQLFORM).
Thanks :)
Upvotes: 2
Views: 1520
Reputation: 14860
Another way to do this:
db.define_table( 'make', Field( 'name' ) )
db.define_table( 'model',
Field( 'name' ),
Field( 'make', db.make, requires = IS_IN_DB( db, 'make.id', '%(name)' ) ) )
Upvotes: 0
Reputation: 4248
It depends and I suggest you take this on the web2py mailin list. One way to do it is
db.table.field.requires=IS_IN_DB(db,'othertable.id','%(otherfield)',multiple=True)
Upvotes: 1