cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <>
Subject Re: [Flow] Going back and forth with continuations
Date Sat, 14 Dec 2002 06:52:11 GMT
Hi Ugo,

On Friday, Dec 13, 2002, at 08:18 US/Pacific, Ugo Cei wrote:

> Dear flow gurus,
> suppose I have an application that implements the following workflow:
> 1. Present the user a form to be filled.
> 2. When the user submits the form, present him a confirmation page, 
> with two buttons: "Confirm" and "Go back"
> 3a. If the user presses "Confirm", perform some job (e.g. save form 
> field values to a database) and show a "thank you" page.
> 3b. If the user presses "Go back", go to step 1.
> I've tried to implement this use case in a flowscript like the 
> following:
> function foobar() {
>   // Note the use of the "new style" function names
>   sendPageAndWait("showform", {});
>   // Collect request parameters here
>   sendPageAndWait("askforconfirmation", { /* ... field values ... */ 
> });
>   sendPage("thankyou", {});
> }
> In the initial form and the confirmation page, I use forms with an 
> action of "kont(" + <jpath:continuation/> + ")".
> In the confirmation page, I implement the "Go back" with a link to the 
> following URI: "kont(" + <jpath:continuation select="2"/> + ")".
> The value "2" for the "select" attribute is because it looks like 
> using "1" actually refers to the "current" continuation and not the 
> "previous" one as I thought initially. Am I correct and is this a 
> "feature" or a "bug"?

I don't see how "1" could refer to the current continuation. Both in 
jpath.xsl and in, "0" refers to the current 
continuation. Could you please post the relevant code which exhibits 
the problem?

> Anyway, that's not a big issue. The big issue is that it does not seem 
> possible to use a continuation to go back to the first form. My 
> understanding is that the first continuation is created, so to say, 
> *after* the first "sendPageAndWait", so there's no state saved before 
> the first form is shown.

The first continuation is created and an id associated with it right at 
the moment you send the first page. That's how you can embed a link to 
it in "showform" or "askforconfirmation".

> If this is indeed the case, how do you propose to implement this use 
> case with Flow? At the moment, I have resorted to using a link of the 
> kind <a href="#" onClick="window.back();return false;"> but I don't 
> really like this solution. I could also use a loop, test a request 
> parameter from the confirmation form and use it to decide between 
> doing a "break" or a "continue", but I don't like it either.

Embedding a "submit" and "prev" button in any of the "showform" or 
"askforconfirmation" pages should be as simple as doing 
<jpath:continuation/> and <jpath:continuation select="1"/> 
respectively. If this doesn't work, there's a bug in the flow code that 
handles this.

Could you please post or send the sources privately so I can take a 
look at them?


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

View raw message