Il 07/06/16 15:24, Anthony ha scritto:
> Again, it might help to see more code. For example, are you calling
> session.forget() at any point? What does the session look like at each
> stage (i.e., as each form is created and as each is submitted)? It
> sounds like the formkey for each form is not in the session, but not
> clear why.
>
> Anthony

Ok just try this simple code:

* controllers/test.py

# -*- coding: utf-8 -*-

# try something like

def index(): return dict(message="hello from test.py")

def myform():

    form = SQLFORM.factory(

        Field("name")

    )

    if form.validate(formname=request.args(0)):

        print "Yes"

    else:

        print "No"

    return dict(form=form)

* views/test/index.html

{{extend 'layout.html'}}
<h1>This is the test/index.html template</h1>

{{for name in ("foo", "bar", "spam",):}}
    {{=LOAD(request.controler, "myform.load", ajax=True, targer="cmp-%s" % 
name)}}
{{pass}}

{{=BEAUTIFY(response._vars)}}

You'll notice that:

1. Each time you'll reload the whole page the first two forms will need
TWO submit to get a success message.
The first time the form validation fails because the formkey submitted
does not match with the one in session (even if I have specified
different formname for each form loaded)

2. After every reload of the whole page only the third component loaded
get a success message after a single submit.

It seams to mean that only a formkey is saved in session and each form
refers to the same formname to match the formkey passed in request.

Is it a correct behaviour? Have I missed something in my code to get the
expected result?

Thank you very mutch

Cheers

    Manuele

-- 
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.

Reply via email to