The form object is passed to your makereport function from the woody2.js
this is due to the lines:
<map:call function="woody">
<map:parameter name="function" value="makereport"/>
<!--using the following element for its form definition-->
<map:parameter name="form-definition" value="forms/form1.xml"/>
</map:call>
Therefore your function definition would look like this
function makereport(form) {
print("before showform");
form.showForm("form1-display-pipeline");
...
Joe
----- Original Message -----
From: "Joakim Verona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 20, 2003 2:04 AM
Subject: cocoon woody/flow question
> Hello list,
>
> I'm trying to build a very simple woody/flow example, and have a
> question on how the woody/flow interaction works.
>
> 1) If I look at the "guess a number game" in the cocoon wiki, it doesn't
> use woody forms, just flow, and is pretty straightforward.
>
> 2) If I look at the woody/flow sample it uses the woody js function to
> start up the form. That starts up a form, loops it until it validates,
> and then shows an answer page. Pretty straightforward too.
>
>
> Now, in my own exampe, I would like to jump between several different
> forms with the flow function.
> I cant then initialize the forms with the woody function. Some wiki
> examples indicate that this isnt necessary either,
> and I cant find the actual purpose of it either.
>
> So I have tried making a woody form this way, and it behaves oddly:
>
> A) If I use a "<input type=submit>" tag directly in the template,
> validation works, but it never leaves the validation loop.
> The same form is just iterated all the time.
>
> B) If I use a wd:submit tag (with validation=true) the validation loop
> isnt done, but its possible to see the value of the validation parameter:
>
>
cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");
>
> the little flow function looks like below.
>
> function makereport() {
> var form = new Form("forms/form1.xml");
> print("before showform");
> form.showForm("form1-display-pipeline");
> print("after showform"); //never gets here in case A
> //gets here immediately regardless of validation in case B
> var model = form.getModel();
> if (form.isValid) {
> print("d1=" + model.startdate);
> print("d2=" + model.enddate);
> } else {
> print("Form is not valid");
> }
> cocoon.sendPageAndWait("ok.html");
> }
>
> How is this supposed to be done? Must each form be initialized with the
> woody function?
> Doesn't this limit the possibilities of the flowscript to use only one
form?
> Have I missed something?
>
>
> (please reply also to me if possible)
> Regards,
> Joakim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]