It is always fun to see Massimo asking questions, because he can usually comes up with a clean solution based on some unpopular web2py trick. :) This time, it is the SQLFORM(..., fields=...) that I did not notice. Thanks. :)
Thadeus also gives a good suggestion. And this kind of logic is better implemented by a client side technic to gain faster UI response. -- Iceberg On May29, 11:57pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > I would use the jQuery form wizard plugin. It is very nice and dose > the pagination for you. > > The only issue is if the data in the second step depend on what is in > the first step, then you would need to use some ajax/javascript to > alter accordingly. > > -- > Thadeus > > On Sat, May 29, 2010 at 10:39 AM, Mathieu Clabaut > > > > <mathieu.clab...@gmail.com> wrote: > > Nice idea ! > > I needed something similar... I'll give a try.. > > Thanks ! > > > On Sat, May 29, 2010 at 17:19, mdipierro <mdipie...@cs.depaul.edu> 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