The accepts must have fomrnames (different onces)

form1.accepts(request.vars, session, formname='form1')

On Dec 27, 10:18 am, Pawel Jasinski <pawel.jasin...@gmail.com> wrote:
> hi,
>
> when I try to put multiple forms generated with SQLFORM.factory things
> act a bit odd.
>
> #controller
> def index():
>     form1  = SQLFORM.factory(Field('a'))
>     if form1.accepts(request.vars, session) :
>         print "form1 accepted"
>     form2 = SQLFORM.factory(Field('b'))
>     if form2.accepts(request.vars, session) :
>         print "form2 accepted"
>     return dict(form1=form1, form2=form2)
>
> #view
> {{extend 'layout.html'}}
> {{=form1}}
> {{=form2}}
>
> first submit button will not produce any positive accept.
> Second submit button will trigger accept for the first form (field a)
> My understanding: each form has unique _formkey and should prevent
> duplicate submits and crossovers like the one above. But when I look
> at the code, I got impression that the critical filtering is based on
> the _formname which in both cases is no_table_create
> Is there anyway to fix it without making modification to the web2py
> itself?
>
> Cheers,
> Pawel

Reply via email to