Of course, accepts() is not ment to be called multiple times. The
reason it swallows is because it uses sessions to prevent double
submission. So basically calling form.accepts twice is like double
submitting the form from your controller.
To avoid protection against double submission, just call
``form.accepts(request.vars)`` without the session object.
--
Thadeus
On Thu, Apr 22, 2010 at 8:32 AM, selecta wrote:
> due to some strange code that I produced I found that form.accepts
> will swallow the formkey etc.
>
> def index():
> return dict()
>
> def noformsubmit():
> form = form_factory(Field('tag_name'))
> msg = 'no'
> for i in range(1):
> if form.accepts(request.vars, session):
> msg = 'yes'
> return dict(form = form, msg = msg)
>
> index.html
> {{=LOAD('default', 'noformsubmit', ajax = True)}}
>
> noformsubmit.html
> msg: {{=msg}}
> {{=form.custom.begin}}
>
>
> {{=form.custom.end}}
>
> on the initial call the formkey will be swallowed
> if the form is submitted the formkey will be added to the form
>
> even though you might not want to produce this code the behavior is
> strange and should not be like that
>
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>