> > Commenting out the following lines shows servers as a drop down list > on the insert site_servers form, leaving the line active causes the > servers line to be a text input field. > > # Test for uniqueness across site_id and server_id > db.site_servers.server_id.requires = IS_NOT_IN_DB(db > > (db.site_servers.site_id==request.vars.site_id),db.site_servers.server_id)
Sorry I was looking in the forum and did not find the answer, The proper explanation is in the 3rd edition of the book Chapter 7 Forms and Validators at the end of the IS_IN_DB() description. Use the 4th parameter to IS_IN_DB() _all = followed by the IS_NOT_IN_DB() code above. db.site_servers.server_id.requires = IS_IN_DB(db, 'servers.id', '% (hostname)s', _all= IS_NOT_IN_DB(db(db.site_servers.site_id==request.vars.site_id),'db.site_servers.server_id') ) ) Added in case someone searches, finds this, at least they will see a solution.