Continuing with the exercise; I've added some additional complexity to the controller. The problem is that I'm getting the "user is tampering with form" error again.
Details: - I'm working with the update revision 729 at SVN (Python 2.5.4) - The model continues to be the same. - The error is raised when I submit either form3 or form2. - form1: handles all the actions on "recurso" - form2: Is only a button to clean and start again. (Submitting this form rise an error) - form3: at the moment only gives the possibility to chose one "recurso" and one "objetivo" and create a relationship. (Submitting this form rise an error) Objective: - The final idea is to create a simple page that allows to add / modify / delete "recursos" and also gives to the user the possibility to specify relationships with many "objetivos". - The controller is not yet completed. But in theory it should work (obviously is not) Following is the new controller and finally is the error stack. Thanks for your help! Juan ################################ Controller ######################################## def abm_recurso(): if request.vars.has_key('id'): records=db (db.recurso.id==request.vars.id).select() if request.vars.has_key('id') and len(records): form1=SQLFORM(db.recurso,records [0],deletable=True,submit_button='Modificar') rec_obj=db((db.recurso.id==db.rec_obj.recurso)& (db.objetivo.id==db.rec_obj.objetivo)& (db.recurso.id==request.vars.id)) records2=rec_obj.select() form3=SQLFORM (db.rec_obj,submit_button='Agregar',_formname='f3') else: form1=SQLFORM(db.recurso,submit_button='Agregar') form3=FORM() records2='' form2=FORM(INPUT(_type='submit',_name='NuevoRecurso',_value='Nuevo Recurso')) if form1.accepts(request.vars,session,formname='form1') and request.vars.has_key('id'): redirect(URL(r=request,f='abm_recurso')) # to clean the form. if form2.accepts(request.vars,session,formname='form2'): redirect (URL(r=request,f='abm_recurso')) # to clean the form. form3.accepts(request.vars,session,formname='form3') if form1.errors: response.flash='Form has Errors' if form3.errors: response.flash='Form has Errors' records=db().select(db.recurso.ALL) return dict (form1=form1,form2=form2,form3=form3,records=records,records2=records2) ################################ Error ######################################## Traceback (most recent call last): File "f:\Web2Py\web2py.dev\gluon\restricted.py", line 98, in restricted exec ccode in environment File "f:/Web2Py/web2py.dev/applications/Recursos/controllers/ default.py", line 70, in <module> File "f:\Web2Py\web2py.dev\gluon\globals.py", line 75, in <lambda> self._caller = lambda f: f() File "f:/Web2Py/web2py.dev/applications/Recursos/controllers/ default.py", line 30, in abm_recurso form3.accepts(request.vars,session,formname='form3') File "f:\Web2Py\web2py.dev\gluon\sqlhtml.py", line 482, in accepts raise SyntaxError, 'user is tampering with form' SyntaxError: user is tampering with form On Feb 17, 9:08 am, Juan Andres Ramil <juan.andres.ra...@gmail.com> wrote: > Yes it's working perfectly. > Thanks! > > Juan > > 2009/2/15 mdipierro <mdipie...@cs.depaul.edu> > > > > > I believe this is fixed now in trunk but needs to be tested. Can you > > please try it works with your code? > > > Massimo > > > On Feb 15, 9:15 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > Yes this is a bug introduced in one of the recent versions. It > > > prevents multiple forms on the same page. I will fit later today. > > > > Massimo > > > > On Feb 13, 2:41 pm, vamaq <juan.andres.ra...@gmail.com> wrote: > > > > > Hi everybody, > > > > > I'm having a problem with a multiple form page. When I submit the > > > > first form (called form) I get the "user is tampering with form" error > > > > at the trace. > > > > > The model is: > > > > > db=SQLDB('sqlite://storage.db') > > > > > db.define_table('recurso', > > > > SQLField('nombre','string',length=100,notnull=True)) > > > > db.recurso.nombre.requires=[IS_NOT_IN_DB > > > > (db,'recurso.nombre'),IS_NOT_EMPTY()] > > > > > db.define_table('objetivo', > > > > SQLField('descripcion','string',length=100,notnull=True, requires= > > > > [IS_NOT_IN_DB(db,'objetivo.descripcion'),IS_NOT_EMPTY()])) > > > > > db.define_table('rec_obj', > > > > SQLField('recurso',db.recurso), > > > > SQLField('objetivo',db.objetivo)) > > > > db.rec_obj.recurso.requires=IS_IN_DB(db,'recurso.id') > > > > db.rec_obj.objetivo.requires=IS_IN_DB(db,'objetivo.id') > > > > > The controller is: > > > > > def index(): > > > > > records=db(db.recurso.id==11).select() > > > > > form=SQLFORM(db.recurso,records[0],deletable=True) > > > > form3=SQLFORM(db.rec_obj) > > > > > form.accepts(request.vars,session,formname='myform1') > > > > form3.accepts(request.vars,session,formname='myform2') > > > > > if form.errors: response.flash='Form has Errors' > > > > if form3.errors: response.flash='Form has Errors' > > > > > return dict(form1=form,form3=form3) > > > > > I will appreciate any guidance. > > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---