cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: (Hopefully!) simple question about recalling data in field in cocoon form
Date Sun, 22 Jan 2006 17:19:04 GMT
> Imagine I have a set of form pages that are logically linked (i.e. Page 
> A -> Page B -> Page C etc which continue to some kind of final 
> processing), is it possible to present
> a breadcrumb trail for the user, i.e. if they have completed Page A, B, 
> C,etc, can we include some kind of mechanism that will take them back to 
> any of the pages they have previously
> filled in and be presented with their data? Will I have to bookmark each 
> continuation at each page so I can return to that particular point, or 
> is there something far simpler involved?

There are a few different ways to approach the multi-page form problem. 
  One of them is to use a single Form object with multiple widget groups 
and use widget states to show one group at a time, which is demonstrated 
in the multipage form sample:

If for some reason your application requires a separate Form object for 
each page, you can still accomplish the same effect, it just takes some 
more creative use of flowscript to keep all the Form objects around and 
switch between them.  Off the top of my head something like the 
following should give you a start:

function multipage_flow() {
    var forms = [
       new Form("form1.xml"),
       new Form("form2.xml"),
       new Form("form3.xml")
    var currentFormIndex = 0;

    var finished = false;
    while(!finished) {
       var form = forms[currentFormIndex];
       switch(String(form.submitId)) {
          case "gotoNextForm":
             currentFormIndex++; break;
          case "gotoPreviousForm":
             currentFormIndex--; break;
          case "finishForm":
             finished = true; break;

    // all forms are completed, now handle the result...

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message