> step = 0
> for i in STEPS:
> if step == 0:
> session.myformt = {}
> fields=STEPS[i]
> print "Fields:" + str(fields) + "Trip Day" + str(step)
> if isinstance(fields,tuple):
> form = SQLFORM.factory(*[f for f in db.myform if f.name in
> fields])
>
You loop over STEPS but keep overwriting "form" on each iteration, so at
the end of the loop, "form" is just the form associated with the last step.
Anyway, if you want all the steps on a single HTML page, don't do it this
way (SQLFORM.factory will generate a separate form for each step, which you
do not want). Just create a single form with multiple fieldsets, and
show/hide the fieldsets as you go from step to step (this is what jQuery
Steps does). You will have to create custom form markup in the template (or
create a custom formstyle function), as the built-in formstyles for SQLFORM
will not generate the HTML markup you need.
In short, in the web2py controller, just create a single standard SQLFORM
using all of the fields. Then in the view, generate markup like you see
here: http://www.jquery-steps.com/Examples#advanced-form. See
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms
for details on generating the custom form markup.
Anthony
--
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.