### Controller for poc form
def insert_poc(): form=SQLFORM(db.poc) if form.process().accepted: response.flash = T('Record added') return dict(form=form) I've posted the full model, the function is colled in _before_insert: db.poc._before_insert.append(lambda dati: controlla_record(dati)) Il giorno giovedì 18 febbraio 2016 17:28:15 UTC+1, Anthony ha scritto: > > We need to see the full code, including the controller. In particular, you > show a callback function, but you do not show where it is called. > > Anthony > > On Thursday, February 18, 2016 at 8:55:49 AM UTC-5, Ivan Gazzola wrote: > > > db.define_table('poc', > Field > <https://xortho.it/examples/global/vars/Field>('Name',required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Birthday','date',widget=bsdatepicker_widget(),required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Angle_Class_Dx',label=T > <https://xortho.it/examples/global/vars/T>("Angle's Class Dx")), > Field > <https://xortho.it/examples/global/vars/Field>('Angle_Class_Sn',label=T > <https://xortho.it/examples/global/vars/T>("Angle's Class Sn")), > Field > <https://xortho.it/examples/global/vars/Field>('Facial_Type'), > Field > <https://xortho.it/examples/global/vars/Field>('Overjet'), > Field > <https://xortho.it/examples/global/vars/Field>('Overbite'), > Field <https://xortho.it/examples/global/vars/Field>('Sex'), > Field > <https://xortho.it/examples/global/vars/Field>('Ratial'), > Field > <https://xortho.it/examples/global/vars/Field>('Cot1','upload',required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Cot2','upload'), > Field > <https://xortho.it/examples/global/vars/Field>('Cot3','upload'), > Field > <https://xortho.it/examples/global/vars/Field>('Clench','upload',required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Chewing_dx','upload',required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Chewing_sn','upload',required=True), > Field > <https://xortho.it/examples/global/vars/Field>('Lateral_Ceph','upload'), > Field > <https://xortho.it/examples/global/vars/Field>('Dental_Formula','text'), > auth.signature > ) > > > > def controlla_record(dati): > nascite=db(db.poc.Birthday==dati.get("Birthday")).select() > for soggetto in nascite: > if CRYPT <https://xortho.it/examples/global/vars/CRYPT>()(request > <https://xortho.it/examples/global/vars/request>.vars.get("Name",'').upper())[0]==soggetto.Name: > response.flash=T("Duplicate Records Not Allowed") > return "errore" > > > db.poc.Angle_Class_Dx.requires = IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','I'),('2','II'),('3','III')]) > db.poc.Angle_Class_Sn.requires = IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','I'),('2','II'),('3','III')]) > db.poc.Facial_Type.requires=IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>({'N':'Normo','O':'Open','D':'Deep'}) > db.poc.Overjet.requires=IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','OJ < > 2mm'),('2','2mm < OJ < 4mm'),('3','OJ > 4mm')]) > db.poc.Overbite.requires=IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>([('1','OB < > 2mm'),('2','2mm < OB < 4mm'),('3','OB > 4mm')]) > db.poc.Sex.requires=IS_IN_SET > <https://xortho.it/examples/global/vars/IS_IN_SET>({'M':'Male','F':'Female'}) > db.poc.Name.requires=[IS_UPPER > <https://xortho.it/examples/global/vars/IS_UPPER>(),CRYPT > <https://xortho.it/examples/global/vars/CRYPT> > > ... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.