This will probably a facepalm moment but I can not figure it out.
My present used form function
form = SQLFORM.factory(
Field('setup', requires=IS_IN_DB(db, db.setup.setupname, '%(setupname)s')
))
Model
db.define_table('setup',
Field('setupname', type='string',
IS_IN_DB takes a DAL set, so you can limit the records returned. If you want
the record ID returned, use db.setup.id. So, maybe something like this:
Field('setup', requires=IS_IN_DB(db(db.setup.ready==True), db.setup.id,
'%(setupname)s'))
Anthony
On Wednesday, July 13, 2011 9:06:03 PM
For reference, see
http://web2py.com/book/default/chapter/07#Database-Validators.
On Wednesday, July 13, 2011 9:21:54 PM UTC-4, Anthony wrote:
IS_IN_DB takes a DAL set, so you can limit the records returned. If you
want the record ID returned, use db.setup.id. So, maybe something like
Oh, and to get rid of the empty choice at the top of the list, add
zero=None:
IS_IN_DB(..., zero=None)
On Wednesday, July 13, 2011 9:22:50 PM UTC-4, Anthony wrote:
For reference, see
http://web2py.com/book/default/chapter/07#Database-Validators.
On Wednesday, July 13, 2011 9:21:54
Thanks about 1 zillion times :)
Oh, and to get rid of the empty choice at the top of the list, add
zero=None:
IS_IN_DB(..., zero=None)
On Wednesday, July 13, 2011 9:22:50 PM UTC-4, Anthony wrote:
For reference, see
http://web2py.com/book/default/chapter/07#Database-Validators.
5 matches
Mail list logo