On a tabel tie: db.define_table('tie', Field('hubID','reference node',**isnode), Field('nodeID','reference node',default='',ondelete='CASCADE',notnull=True), ... on_define=set_requirement, migrate=False)
I defined the following validator: def set_requirement(tie): tie.nodeID.requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a value')),IS_NOT_IN_DB(db(db.tie.hubID==request.vars.hubID),'tie.nodeID',error_message=T('combination hub and node already in database'))] Again in appadmin when I enter hubID 11 and nodeID 3 the second time I get the error_message, however, in form=crud.update(db.tie) and form=SQLFORM.factory(db.tie,record=row) and db.tie.insert(hubID=id,nodeID=row.id) this combination is entered without this being prevented by the validator. I defined my validators this way to make use of lazy_table=True. Does the fact that validators defined this way are ignored in the controller mean that I have to revert to my previous validator definitions and that I cannot make use of lazy_tables? (I am still working in web2py 2.0.9, maybe this issue has been resolved in 2.2.x) Kind regards, Annet. --