On Fri, Jul 23, 2004 at 04:41:36PM +0400, Timur Izhbulatov wrote: Sorry, some attachments have been deleted. Here they are: //--------- //client.js: //---------- cocoon.load("flow/common/document.js"); cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
// var pipelineUtil = cocoon.createObject( // Packages.org.apache.cocoon.components.flow.util.PipelineUtil); 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); 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/"); } function createClient() { var dataBase = cocoon.parameters["data-base"]; var ID = getNewClientID(dataBase); var dataURI = dataBase + ID; if(!isLoadable(dataURI)) { // Initialize DB with an empty resource var document = loadDocument("data/clients/empty.xml"); saveDocument(document, dataURI); } cocoon.sendPage("edit/" + ID); } function getNewClientID(uri) { var document = loadDocument(uri); if (document != null) { try { var ID = document.getDocumentElement().getAttribute("resources"); ID = ID - 0 + 1; // Substract zero in order to convert string to int return ID; } catch (error) { cocoon.log.error("Invalid document data: " + error); } } else { cocoon.log.error("Error loading document from: " + uri); } } //------------- //client_new.js //------------- cocoon.load("flow/common/document.js"); cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js"); // var pipelineUtil = cocoon.createObject( // Packages.org.apache.cocoon.components.flow.util.PipelineUtil); function editClientNew() { 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 formList = new Array(model.list.length); // var list = new Array(model.list.length); for(i = 0; i < model.list.length; i++) { // list[i] = model.list[i]; formList[i] = new Form("forms/" + model.list[i] + "_form.xml"); formList[i].createBinding("forms/" + model.list[i] + "_bind.xml"); } var i = 0; var done = null; while( (i >= 0) && (i < formList.length) ) { var doc = loadDocument(bindingURI); formList[i].load(doc); form.showForm(model.list[i] + "-display-pipeline"); form.save(doc); saveDocument(doc, bindingURI); i++; } // list.push(clientID, dataBase, dataURI); // cocoon.sendPage("test-pipeline", {"list":list}); cocoon.redirectTo("../browse/"); } > Hi all! > > I have two functions that handle two corresponding pipelines. They use the > same form model, template and binding definitions and the same pipeline to > show the form (please, see attached files for details). The frist function > works almost as expected but the second one fails when it whants to display > the form. The falure appears when cocoon executes the form displaying > pipeline at forms transformation. > > Here is the error message: > > Failed to execute pipeline. > > org.apache.cocoon.ProcessingException: Failed to execute pipeline.: > org.xml.sax.SAXException: EffectFormTemplateTransformer: Widget with id > "number" does not exist in the form container. > > What's wrong? Please, help! > > Timur > <?xml version="1.0"?> > <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> > <!-- This should be reorganized in more optimal way. E.g. there should be a > resource for applying frequently used parametric transformation --> > <map:components> > <!-- > <map:generators default="file"> > <map:generator logger="forms" name="forms" > src="org.apache.cocoon.forms.generation.FormsGenerator" /> > <map:generator name="jx" > src="org.apache.cocoon.generation.JXTemplateGenerator" label="content" > logger="sitemap.generator.jx" /> > </map:generators> > --> > > <map:serializers default="html"> > <map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" > name="xml" pool-grow="4" pool-max="32" pool-min="4" > src="org.apache.cocoon.serialization.XMLSerializer"> > <encoding>UTF-8</encoding> > </map:serializer> > > <map:serializer logger="sitemap.serializer.html" mime-type="text/html" > name="html" pool-grow="4" pool-max="32" pool-min="4" > src="org.apache.cocoon.serialization.HTMLSerializer"> > <doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public> > <doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system> > <encoding>UTF-8</encoding> > </map:serializer> > > </map:serializers> > > <map:transformers default="xalan"> > <map:transformer logger="forms" name="forms" > src="org.apache.cocoon.forms.transformation.FormsTemplateTransformer" /> > <!-- > <map:transformer name="i18n" > src="org.apache.cocoon.transformation.I18nTransformer"> > <catalogues default="other"> > <catalogue id="other" name="OtherMessages" location="messages" /> > <catalogue id="forms" name="FormsMessages" location="messages" /> > </catalogues> > <cache-at-startup>true</cache-at-startup> > </map:transformer> > --> > > </map:transformers> > </map:components> > > <map:resources> > <!-- this will later become a virtual transformer --> > <map:resource name="simple-page2html"> > <map:transform src="style/xsl/simple-page2html.xsl"> > <map:parameter name="contextPath" value="{request:contextPath}" /> > <map:parameter name="servletPath" value="{request:servletPath}" /> > </map:transform> > </map:resource> > > <map:resource name="page2html"> > <map:transform src="style/xsl/page2html.xsl"> > <map:parameter name="contextPath" value="{request:contextPath}" /> > <map:parameter name="servletPath" value="{request:servletPath}" /> > </map:transform> > </map:resource> > > <map:resource name="show-client"> > <map:transform src="style/xsl/client.xsl"> > <map:parameter name="contextPath" > value="{request:contextPath}" /> > </map:transform> > <map:call resource="page2html" /> > <map:serialize /> > </map:resource> > > </map:resources> > > <map:flow language="javascript"> > <map:script src="flow/client.js" /> > <map:script src="flow/client_new.js" /> > </map:flow> > > <map:pipelines> > <!-- Direct data access --> > <!-- FIXME: this pipeline should be internal in production version. > --> > <map:pipeline> > <map:match pattern="data/**"> > <map:generate src="xmldb:xindice-embed:///db/caclient/{1}" /> > <map:serialize type="xml" /> > </map:match> > </map:pipeline> > > <map:pipeline> > <map:match pattern=""> > <map:redirect-to uri="home.html" /> > </map:match> > > <map:match pattern="*.html"> > <map:generate src="data/{1}.xml" /> > <map:call resource="page2html" /> > <map:serialize /> > </map:match> > > <map:match pattern="browse/"> > <map:redirect-to uri="../browse(1)" /> > </map:match> > > <map:match pattern="browse(*)"> > <map:generate src="cocoon:/data/" /> > <map:transform src="style/xsl/xmldb-clients2page.xsl"> > <map:parameter name="contextPath" value="{request:contextPath}" /> > </map:transform> > <!-- > <map:transform src="pagesheets/clients.xml" type="paginate"> > <map:parameter name="page" value="{1}" /> > </map:transform> > --> > <map:call resource="page2html" /> > <map:serialize /> > </map:match> > > <map:match pattern="new/"> > <map:call function="createClient"> > <map:parameter name="data-base" > value="xmldb:xindice-embed:///db/caclient/" /> > </map:call> > </map:match> > > <map:match pattern="**/*.continue"> > <map:call continuation="{2}" /> > </map:match> > > <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="client-id" > value="{1}" /> > </map:call> > </map:match> > > <map:match pattern="edit-new/*"> > <map:call function="editClientNew"> > <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="client-id" > value="{1}" /> > </map:call> > </map:match> > > <map:match pattern="*-client-success-pipeline"> > <map:generate src="cocoon:/data/{1}" /> > <map:serialize type="xml" /> > </map:match> > > <!-- overriding common pipeline --> > <map:match pattern="contract-display-pipeline"> > <map:generate src="forms/contract_tmpl.xml" /> > <map:transform type="forms" /> <!-- FAILS --> > <!-- > <map:transform src="style/xsl/forms-samples-styling.xsl" /> > <map:call resource="simple-page2html" /> > --> > <map:serialize /> > </map:match> > > <map:match pattern="*-display-pipeline"> > <!-- pipeline to show the form --> > <map:generate src="forms/{1}_tmpl.xml" /> > <map:transform type="forms" /> > <map:transform src="style/xsl/forms-samples-styling.xsl" /> > <map:call resource="simple-page2html" /> > <map:serialize /> > </map:match> > > <!-- > FIXME: DEVELOPEMENT STUFF should be removed from production version > --> > <map:match pattern="populate.html"> > <map:generate src="data/populate.xml" /> > <map:transform type="cinclude" /> > <map:transform type="xmldb" /> > <map:serialize /> > </map:match> > > <map:match pattern="test-pipeline"> > <map:generate type="jx" src="forms/select-docs-success_jx.xml"> > <map:parameter name="lenient-xpath" value="true"/> > </map:generate> > <map:serialize /> > </map:match> > > </map:pipeline> > > </map:pipelines> > </map:sitemap> > <?xml version="1.0" encoding="UTF-8"?> > <fb:context > xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" > xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" > path="/Client"> > > <fb:value id="number" path="number"></fb:value> > > <fb:value id="date" path="date"></fb:value> > > <fb:value id="organization-name" path="organization-name"></fb:value> > > <fb:value id="title" path="title"></fb:value> > > <fb:value id="person-name" path="person-name"></fb:value> > > <fb:value id="address" path="address"></fb:value> > > <fb:value id="phone" path="phone"></fb:value> > > <fb:value id="fax" path="fax"></fb:value> > > <fb:value id="INN" path="INN"></fb:value> > > <fb:value id="KPP" path="KPP"></fb:value> > > <fb:value id="settlement-account" path="settlement-account"></fb:value> > > <fb:value id="bank-name" path="bank-name"></fb:value> > > <fb:value id="correspondent-account" path="correspondent-account"></fb:value> > > <fb:value id="BIK" path="BIK"></fb:value> > > <fb:value id="OKPO" path="OKPO"></fb:value> > > <fb:value id="OKONH" path="OKONH"></fb:value> > > </fb:context> > <?xml version="1.0" encoding="UTF-8"?> > <fd:form > xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"> > <fd:widgets> > > <fd:field id="number"> > <fd:label>Ð?Ð?Ð?Ð?Ð? Ð?Ð?Ð?Ð?Ð?Ð?Ð?ÐÂ</fd:label> > <fd:help></fd:help> > <fd:hint>Ð?Ð?Ð?Ð?Ð?Ð?Ð?ÐÑÐ?Ð? Ð?Ð?Ð?Ð?Ð?ÐÑ Ð?Ð?Ð?Ð?Ð? > Ð?Ð?Ð?Ð?Ð?Ð?Ð?ÐÂ</fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="date"> > <fd:label>Ð?ÐÂÐ?ÐÂ</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="organization-name"> > <fd:label>Ð?ÐÂÐÂÐ?ÐÂÐ?ÐÑÐ? > Ð?Ð?Ð?ÐÂÐ?ÐÑÐÂÐÂÐ?ÐÑÐÑ</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="title"> > <fd:label>Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="person-name"> > <fd:label>Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="address"> > <fd:label>Ð?Ð?ÐÑÐ?ÐÑÐ?Ð?Ð?Ð?ÐÑÐ? ÐÂÐ?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="phone"> > <fd:label>Ð?Ð?Ð?Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="fax"> > <fd:label>Ð?Ð?Ð?Ð?Ð? Ð?ÐÂÐ?Ð?ÐÂ</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="INN"> > <fd:label>Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="KPP"> > <fd:label>Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="settlement-account"> > <fd:label>ÐÂÐÂÐ?Ð?Ð?Ð?Ð?Ð?Ð? Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="bank-name"> > <fd:label>Ð?ÐÂÐ?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="correspondent-account"> > <fd:label>Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?Ð?ÐÑÐ? > Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="BIK"> > <fd:label>Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="OKPO"> > <fd:label>Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > <fd:field id="OKONH"> > <fd:label>Ð?Ð?Ð?Ð?Ð?</fd:label> > <fd:help></fd:help> > <fd:hint></fd:hint> > <fd:datatype base="string"></fd:datatype> > <fd:validation><!-- <fd:value-count exact="2"/> --></fd:validation> > </fd:field> > > </fd:widgets> > </fd:form> > <?xml version="1.0" encoding="UTF-8"?> > <page > xmlns:ft="http://apache.org/cocoon/forms/1.0#template" > xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"> > > <title>contract</title> > > <content> > <ft:form-template action="#{$continuation/id}.continue" > method="POST"> > > <ft:widget-label id="number" /> > <ft:widget id="number"></ft:widget> > <br /> > > <ft:widget-label id="date" /> > <ft:widget id="date"></ft:widget> > <br /> > > <ft:widget-label id="organization-name" /> > <ft:widget id="organization-name"></ft:widget> > <br /> > > <ft:widget-label id="title" /> > <ft:widget id="title"></ft:widget> > <br /> > > <ft:widget-label id="person-name" /> > <ft:widget id="person-name"></ft:widget> > <br /> > > <ft:widget-label id="address" /> > <ft:widget id="address"></ft:widget> > <br /> > > <ft:widget-label id="phone" /> > <ft:widget id="phone"></ft:widget> > <br /> > > <ft:widget-label id="fax" /> > <ft:widget id="fax"></ft:widget> > <br /> > > <ft:widget-label id="INN" /> > <ft:widget id="INN"></ft:widget> > <br /> > > <ft:widget-label id="KPP" /> > <ft:widget id="KPP"></ft:widget> > <br /> > > <ft:widget-label id="settlement-account" /> > <ft:widget id="settlement-account"></ft:widget> > <br /> > > <ft:widget-label id="bank-name" /> > <ft:widget id="bank-name"></ft:widget> > <br /> > > <ft:widget-label id="correspondent-account" /> > <ft:widget id="correspondent-account"></ft:widget> > <br /> > > <ft:widget-label id="BIK" /> > <ft:widget id="BIK"></ft:widget> > <br /> > > <ft:widget-label id="OKPO" /> > <ft:widget id="OKPO"></ft:widget> > <br /> > > <ft:widget-label id="OKONH" /> > <ft:widget id="OKONH"></ft:widget> > <br /> > > <input value="Ð?ÐÂÐ?Ð?Ð? >>" type="submit" /> > > </ft:form-template> > </content> > > </page> > > --------------------------------------------------------------------- > 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]