Regards,
Chris
Torsten Curdt wrote:
I don't understand what you mean. As far as I understand it the idea is to invoke a continuation that causes a previous page to be displayed.
yes
Control returns to the flow script when this page is submitted. Whatever values are submitted with the form are modified. Any others retain the same values. What data is lost?
ok ...examples:
page1 - associated with continuation id 1: <wt:form-template action="1.continue" method="POST"> <wt:widget id="email"/> <wt:widget id="phone"/> <input type="submit" value="Next"/> </wt:form-template>
page2 - associated with continuation id 2: <wt:form-template action="2.continue" method="POST"> <wt:widget id="address"/> <wt:widget id="zip"/> </wt:form-template>
Now how do we go back
1) Link
<wt:form-template action="2.continue" method="POST"> <wt:widget id="address"/> <wt:widget id="zip"/> <a href="1.continue">Back</a> </wt:form-template>
Does (of course) not work. We need a POST to save the values from page2
2) Always POST to same continuation (as Sylvain suggested)
What I did not understand:
<wt:form-template action="1.continue" method="POST"> <wt:widget id="address"/> <wt:widget id="zip"/> <input type="submit" value="Back"/> </wt:form-template>
... sendPageAndWait(page1) -> continuation 1 continuation1: save values from page1 ... sendPageAndWait(page2) -> continuation 2 continuation2: save values from page2 ...
Since we go back to continuation1 again and woody is meant to use indirect population we would always try to save values of page1 *not* page2. *And* we end up showing page2 again. Of course...
So we would need to specify what to show...
<wt:form-template action="1.continue" method="POST"> <wt:widget id="email"/> <wt:widget id="phone"/> <input type="submit" name="wizard-page2" value="Next"/> </wt:form-template>
<wt:form-template action="1.continue" method="POST"> <wt:widget id="address"/> <wt:widget id="zip"/> <input type="submit" name="wizard-page1" value="Back"/> <input type="submit" name="wizard-page2" value="Next"/> </wt:form-template>
... sendPageAndWait(page1) -> continuation 1 continuation1: var page = extractWizardPage("wizard-",cocoon.request); if (page == "page1") { sendPageAndWait(page1) -> continuation x continuationx: save values from page1 "goto" continuation1 } else if (page == "page2") { continuationy: sendPageAndWait(page2) -> continuation y save values from page2 "goto" continuation1 } else { }
But how should this work when we always continue with continuation 1? We never go back to continuation x or y
Well, we could move the value saving...
... sendPageAndWait(page1) -> continuation 1 continuation1: var page = extractWizardPage("wizard-",cocoon.request); save values from page ? if (page == "page1") { sendPageAndWait(page1) -> continuation x } else if (page == "page2") { sendPageAndWait(page2) -> continuation y } else { }
But since woody is meant to use indirect population we need to know the page we are coming from. So the only way see is to pass this request parameter as well.
... sendPageAndWait(page1) -> continuation 1 continuation1: var to = extractWizardPage("wizard-to-",cocoon.request); var from = extractWizardPage("wizard-from-",cocoon.request);
if (from == "page1") { save values from page1 } else if (from == "page2") { save values from page2 }
if (to == "page1") { sendPageAndWait(page1) -> continuation x (never used) } else if (to == "page2") { sendPageAndWait(page2) -> continuation y (never used) } else { }
But this is stupid and does not use the continuation features at all. I guess the re-use of the continuation got me on the wrong track.
What I (guess) Sylvain had in mind was (please fire at will ;)
... continuation1: sendPageAndWait(page1) -> continuation 2 continuation2: save values from page1 if (cocoon.request.getParameter("wizard-back")) { "goto" continuation1 } ... continuation3: sendPageAndWait(page2) -> continuation 4 continuation4: save values from page2 if (cocoon.request.getParameter("wizard-back")) { "goto" continuation3 } ...
Of course more modular ;)
Puh... Are we now all on the same page? :) -- Torsten
