You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Timur Izhbulatov <ti...@yxo.ru> on 2004/07/14 17:18:28 UTC

CForms, flow script and continuations

Hi! 

I have a problem with flow script. A function (see bellow) that shows a 
simple form with a selection list where I can select some values (which docs 
I want to edit). The function retrieves these values and displays a form for 
each item in the selection list. 

When I just submit these forms as they appear, everything goes fine. The 
problem appears when I click the back button instead of submitting the first 
form and return to the selection list. Now if I make the selection and click 
submit I can't get any values from the selection list 'cause dot operation 
(model.list) returns an undefined value. 

What's wrong? 

Please, help. 

Here's my sytemap entry:
     <map:match pattern="edit/*">
       <map:call function="editClient">
         <map:parameter name="form-definition"
           value="forms/select-docs_form.xml" />
         <map:parameter name="data-base"
           value="xmldb:xindice-embed:///db/caclient/" />
         <!--
         <map:parameter name="data-base"
           value="data/clients/" />
         -->
         <map:parameter name="client-id"
           value="{1}" />
       </map:call>
     </map:match 


And here is the script: 

function editClient() {
   var form       = new Form(cocoon.parameters["form-definition"]);
   var clientID   = cocoon.parameters["client-id"];
   var bindingURI = cocoon.parameters["data-base"] + clientID; 

   // show the selection form
   form.showForm("select-docs-display-pipeline"); 

   // show a form for each document in the selection list
   model = form.getModel();
   // var list = new Array(model.list.length);

   /**************** HERE!**************/
   for(i = 0; i < model.list.length; i++) {
       // list[i]     = model.list[i];
       var docName = model.list[i]; 

       var form       = new Form("forms/" + docName + "_form.xml");
       form.createBinding("forms/" + docName + "_bind.xml"); 

       var doc = loadDocument(bindingURI);
       form.load(doc);
       form.showForm(docName + "-display-pipeline");
       form.save(doc);
       saveDocument(doc, bindingURI)
   }

   // list.push(clientID, dataBase, dataURI);
   // cocoon.sendPage("test-pipeline", {"list":list});
   cocoon.redirectTo("../browse/");
} 

Timur

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org