mandag 21. desember 2015 14.11.11 UTC+1 skrev Anthony følgende:
>
> if form1.process(formname="form_one").accepted:
>> form2 = FORM(INPUT(_id = '0', _name = '0'),
>> INPUT(_id = '1', _name = '1'),
>> INPUT(_id = '2', _name = '2'),
>> INPUT(_type='submit', _value="submit"))
>>
>> if form2.process(formname="form_two"):
>> e = {'p':'process ok'}
>> elif form2.accepted:
>> e = form2.vars
>> else:
>> e = {'s':'something else'}
>> return {'form2':form2, 'e':e}
>>
>
> form2 is only processed when form1 is submitted and accepted, so when you
> submit form2, the if form1.process(formname="form_
> one").accepted condition will be false, and none of the remaining code
> will be executed.
>
> After form1, you might instead want to redirect to another action to
> handle form2. If you want to handle two forms in the same action, and the
> second depends on the first having been submitted, may store a flag in the
> session indicating that, and serve/process form2 contingent on that flag
> being there (reset the flag after form2 has been submitted).
>
> Anthony
>
Thx.
I was hoping I could avoid redirect. Have to redirect to self then, and
then keep output from form1 in session, so than could be used as input in
form2.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.