In db.py I defined the following table: db.define_table('company', Field('name',length=54,default='',notnull=True), Field('CoC_number',length=8), Field('subdossiernumber',length=4,default='0000'), ... Field(...), migrate=False)
db.company.CoC_number.requires=IS_NOT_IN_DB(db(db.company.subdossiernumber==request.vars.subdossiernumber),db.company.CoC_number,error_message='combination of CoC-number and subdossiernumber already in database') In a controller I defined one form to update multiple tables. Here are the parts related to the company table: def update(): id= request.args(0) ### retrieve company data company=db(db.company.id==id).select(db.company.ALL) ### create form form=SQLFORM.factory(db.bedrijf,...,...) ### pre-populate form if company: form.vars.name=company[0].name form.vars.CoC_number=company[0].CoC_number form.vars.subdossiernumber=company[0].subdossiernumber ... if form.accepts(request.vars,session): company.update_record(**db.bedrijf._filter_fields(form.vars)) ... session.flash='Records updated' redirect(URL(r=request,f='retrieve',args=id)) elif form.errors: response.flash=response.flash_formerror return dict(form=form) When I execute the function the data is retrieved, the form is created and pre-populated, however, when I click the submit button, the validator on the Coc_number and subdossiernumber field prevents the record from being updated and displays the error_message: 'combination of CoC-number and subdossiernumber already in database' I didn't expect this to happen when updating a record without changing the CoC-number and subdossiernumber, I'd expect this to happen when I change the CoC-number and subdossiernumber of one company to that of another company. Is there a solution to solve this problem? Kind regards, Annet.