Yes. The idea is to user request.args(0) to decide the page of the
wizard and the relative form.

On May 29, 7:36 pm, Robby O'Connor <robby.ocon...@gmail.com> wrote:
> Okay,
>
> Looking at this deeper, I there will be a complete form (one covering
> one db table; then another covering a completely different database
> table. Let me see if I got this right.
>
> Can this implementation idea work for that case?
>
> --rob
> On 5/29/2010 11:19 AM, mdipierro wrote:
>
> > db.define_table('mytable',
> >     Field('field1'),   Field('field2'),   Field('field3'),
> > Field('field4'))
>
> > make sure they all have defaults.
>
> > def wizard():
> >       fields=[['field1'], # first page
> >                  ['field2','field3'], # second page
> >                  ['field4']] # third page
> >       record_id =int(request.args(0) or 0)
> >       page=int(request.args(1) or 0)
> >       form = SQLFORM(db.mytable,record_id,fields=fields[page])
> >       if form.accepts(request.vars,session):
> >           if page<len(fields):
> > redirect(r=request,args=(form.vars.id,page+1))
> >           else: redirect(r=request,f='form_completed'))
> >       return dict(form=form, page=page)
>
> > I did not try it. May need some debugging.
>
> > On May 28, 6:20 pm, "Robert O'Connor"<robby.ocon...@gmail.com>  wrote:
>
> >> Hey,
>
> >> I need to implement a "wizard" style form. (things will exist on
> >> different screens; each "step" or page will post to the next page and
> >> have those values stored and used in the next step.
>
> >> Now here's the problem: there's seems to be very few examples in
> >> developing something like this in web2py... Does anybody know either
> >> of an app that does this that I can look at for examples or perhaps a
> >> strategy of implementing this?
>
> >> If you're in the United States -- Happy Memorial Day weekend!
> >> -Robert O'Connor

Reply via email to