Hi,
I am facing the same problems with validations (using dynamic CForms).
Is there a solution for this or is it impossible to do this in cocoon?

Regards,
Anish


asif_zzz wrote:
> 
> Hi Mark,
> 
> Im facing some integration problems when dynamically creating the CForms
> Template,Definition and binding.
> My Global validation error block is not working when doing this. When i
> remove the dynamic artifacts,Global validation error block works fine.
> 
> Both these features works independently.
> 
> Any suggestion ,it would help me to solve this problem.
> 
> Here i post the my codes which are related to it
> 
> Sitemap.xmap
> -------------
> 
> <map:match pattern="MainForm-dyna-tmpl">
>       <map:generate src="forms/MainForm_tmpl.xml"/>
>        <map:transform type="xinclude"/>
>       <map:transform src="stylesheets/MainForm_tmpl.xsl"/> 
>       <map:serialize type="xml"/>
> </map:match>
> 
> <map:match pattern="MainForm-dyna-defn">
>       <map:generate src="forms/MainForm_defn.xml"/>
>       <map:transform type="xinclude"/>
>       <map:transform src="stylesheets/MainForm_defn.xsl"/> 
>       <map:serialize type="xml"/>
> </map:match>
> 
> <map:match pattern="formDyna/**">
>       <map:generate src="cocoon:/MainForm-dyna-tmpl" type="jx">
>               <map:parameter name="lenient-xpath" value="true" />
>       </map:generate>
>       <map:transform type="xinclude"/>
>       ....
> </map:match>
> 
> Flow.js:
> -------------
> 
> var form = new Form("cocoon:/MainForm-dyna-defn");
> form.showForm("formDyna/MainForm");
> 
> MainForm_tmpl.xml:
> ---------------------
> 
> <page>
> <ft:form-template id="mainForm"
> action="#{$cocoon/continuation/id}.continue" method="POST"
> enctype="multipart/form-data" ajax="true">
>       <fi:validation-errors>
>       
> <header><p><i18n:text>validationErrorMessageHeader</i18n:text></p></header>
>       
> <footer><p><i18n:text>validationErrorMessageFooter</i18n:text></p></footer>
>       </fi:validation-errors>
> 
>       ....
>       <table>
>               <fields type="sample" cols="5"/>
>       </table>
> </ft:form-template>
> <xi:include href="../data/Fields.xml"/>
> </page>
> 
> MainForm_defn.xml:
> ---------------------
> 
> <fd:form
>       xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
>       xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
>       xmlns:xi="http://www.w3.org/2001/XInclude";>
> 
>       <fd:widgets>
>               ....
>       </fd:widgets>
> <xi:include href="../data/Fields.xml"/>
> </fd:form>
> 
> Fields.xml:
> ----------------
> <infos xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
>       <type1>
>               <info name="c1"><i18n:text>text1</i18n:text></info>
>               <info name="c2"><i18n:text>text2</i18n:text></info>
>               ...
>       </type1>
> </infos>
> 
> MainForm_tmpl.xsl:
> ----------------------
> 
> <xsl:stylesheet version="1.0"
>       xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>       xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
>       xmlns:ft="http://apache.org/cocoon/forms/1.0#template";>
> 
>       <xsl:include
> href="resource://org/apache/cocoon/forms/resources/forms-page-styling.xsl"/>
>       <xsl:include
> href="resource://org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl"/>
>  
>   
>       <xsl:param name="resources-uri">resources</xsl:param>
>       
>       <xsl:template match="fields">
>         <xsl:variable name="cellsPerRow" select="@cols"/>
>         <xsl:variable name="type" select="@type"/>
>         <xsl:for-each 
> select="/page/infos/*[local-name()=$type]/info[position()
> mod $cellsPerRow = 1]">
>           <tr>
>             <xsl:apply-templates select=".|following-sibling::info[position()
> &lt; $cellsPerRow]">
>             </xsl:apply-templates>
>           </tr>
>         </xsl:for-each>
>       </xsl:template>
> 
>       <xsl:template match="info">             
>               <td>
>                   <ft:widget-label>
>                           <xsl:attribute name="id"><xsl:value-of 
> select="."/></xsl:attribute>
>                   </ft:widget-label>
>                   <ft:widget>
>                       <xsl:attribute name="id"><xsl:value-of
> select="@name"/></xsl:attribute>
>                   </ft:widget>
>               </td>
>       </xsl:template>
> </xsl:stylesheet>
> 
> MainForm_defn.xsl:
> ----------------------
> 
> My MainForm_defn stylesheet has the definition artifacts in <xsl:template
> match="info"> tagset,
> rest of the codes are same as MainForm_tmpl.xsl
> 
> <xsl:template match="info">
>       <fd:field>
>               <xsl:attribute name="id"><xsl:value-of 
> select="@name"/></xsl:attribute>
>               <fd:label><i18n:text><xsl:value-of
> select="@name"/></i18n:text></fd:label>
>               <fd:datatype base="string"/>
>       </fd:field>
> </xsl:template>
> 
> 
> Thanks in Advance.
> Regards,
> Aashik
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-create-dynamic-CForms-Template%2CDefinition-and-binding-tp21200337p23575141.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to