Hi,
i'm quite new to Cocoon and CForms.
I'm checking out Forms-related-technologies and having a question on CForms about editing "deep" structures (lists containing lists, etc) now - i'm using 2.2-dev (i've first checked 2.1.51 and then switched to dev), Win2k, JRE 1.4.2_02.
In my first test i'm trying to edit the following xml-structure using CForms:
the "/units/unit"-level forms level one for editing
the "/unit/conversions/conversion" is the level which is supposed to nest in Level1
my approach is to nest repeaters (which doesn't seem to be supported, but maybe i'm missing something) - any suggestions welcome.
the accompanying data, sitemap, template, model, binding - in that order (all being based on the forms2-xml-binding-example):
/* units_data.xml */
<units>
<unit>
<name>Length</name>
<itemid>1</itemid>
<baseconvid>1_1</baseconvid>
<conversions>
<conversion>
<convid>1_1</convid>
<si>
<shortterm>m</shortterm>
<factor>1</factor>
</si>
<imp>
<shortterm>ft</shortterm>
<factor>3,280839895013123</factor>
</imp>
</conversion>
<conversion>
<convid>1_2</convid>
<si>
<shortterm>cm</shortterm>
<factor>100</factor>
</si>
<imp>
<shortterm>in</shortterm>
<factor>39,37007874015748</factor>
</imp>
</conversion>
<conversion>
<convid>1_3</convid>
<si>
<shortterm>mm</shortterm>
<factor>1000</factor>
</si>
<imp>
<shortterm>in</shortterm>
<factor>39,37007874015748</factor>
</imp>
</conversion>
</conversions>
</unit>
<unit>
<name>Area</name>
<itemid>2</itemid>
<baseconvid>2_1</baseconvid>
<conversions>
<conversion>
<convid>2_1</convid>
<si>
<shortterm>m<sup>2</sup></shortterm>
<factor>1</factor>
</si>
<imp>
<shortterm>ft<sup>2</sup></shortterm>
<factor>10,763910416709722</factor>
</imp>
</conversion>
<conversion>
<convid>2_2</convid>
<si>
<shortterm>cm<sup>2</sup></shortterm>
<factor>10000</factor>
</si>
<imp>
<shortterm>in<sup>2</sup></shortterm>
<factor>1550,0031000062001</factor>
</imp>
</conversion>
</conversions>
</unit>
</units>/* sitemap-excerpt */
<map:match pattern="units-display-pipeline">
<map:generate src="units/units_template.xml"/>
<map:transform type="forms"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en-US"/>
</map:transform>
<map:call resource="simple-page2html">
<map:parameter name="file" value="units/units_template.xml"/>
</map:call>
<map:transform src="resources/forms-samples-styling.xsl"/>
<map:serialize/>
</map:match><map:match pattern="units.flow">
<map:call function="handleForm">
<map:parameter name="function" value="form2xml"/>
<map:parameter name="form-definition" value="units/units_model.xml"/>
<map:parameter name="documentURI" value="units/units_data.xml"/>
<map:parameter name="bindingURI" value="units/units_bind_xml.xml"/>
<map:parameter name="successPipeline" value="units-success-pipeline"/>
</map:call>
</map:match>
<map:match pattern="units-success-pipeline">
<map:generate src="units/units_data-result.xml"/>
<map:transform type="i18n">
<map:parameter name="locale" value="en-US"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>------------------------------------------------------------------------------------
/* units_template.xml */
<ft:form-template action="#{$continuation/id}.continue" method="POST">
<ft:widget-label id="runits"/><br/>
<ft:repeater-size id="runits"/>
<table border="1">
<tr>
<th></th>
<th><ft:repeater-widget-label id="runits" widget-id="fname"/></th>
<th><ft:repeater-widget-label id="runits" widget-id="fbaseconvid"/></th>
<!--<th><ft:repeater-widget-label id="runits" widget-id="fselect"/></th>-->
<th></th>
</tr>
<!--Units-Repeater-->
<ft:repeater-widget id="runits">
<tr>
<td><ft:widget id="raaddunit"/><ft:widget id="radelunit"/></td>
<td><ft:widget id="fname"/></td>
<td><ft:widget id="fbaseconvid"/></td>
<td>
<!-- Conversions-Repeater -->
<ft:repeater-size id="rconversions"/>
<table border="1">
<tr>
<th></th>
<th><ft:repeater-widget-label id="rconversions" widget-id="fconvid"/></th>
<th><ft:repeater-widget-label id="rconversions" widget-id="fsishortterm"/></th>
<th><ft:repeater-widget-label id="rconversions" widget-id="fsifactor"/></th>
<th><ft:repeater-widget-label id="rconversions" widget-id="fimpshortterm"/></th>
<th><ft:repeater-widget-label id="rconversions" widget-id="fimpfactor"/></th>
</tr>
<ft:repeater-widget id="rconversions">
<tr>
<td><ft:widget id="raaddconversion"/><ft:widget id="radelconversion"/></td>
<td><ft:widget id="fconvid"/></td>
<td><ft:widget id="fsishortterm"/></td>
<td><ft:widget id="fsifactor"/></td>
<td><ft:widget id="fimpshortterm"/></td>
<td><ft:widget id="fimpfactor"/></td>
</tr>
</ft:repeater-widget>
</table>
</td>
</tr>
</ft:repeater-widget>
</table>
<input type="submit"/>
</ft:form-template>
---------------------------------------------------------------------------------------
/* units_model.xml */
<fd:form
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
<fd:repeater id="runits">
<fd:widgets>
<fd:output id="oid">
<fd:datatype base="long"/>
</fd:output>
<fd:row-action id="raaddunit" action-command="add-after">
<fd:label>+</fd:label>
</fd:row-action>
<fd:row-action id="radelunit" action-command="delete">
<fd:label>-</fd:label>
</fd:row-action>
<fd:field id="fname">
<fd:label>Name</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="fbaseconvid">
<fd:label>Base-ID</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:booleanfield id="fselect">
<fd:label>Select</fd:label>
</fd:booleanfield>
<fd:repeater id="rconversions">
<fd:widgets>
<fd:output id="oconvid">
<fd:datatype base="long"/>
</fd:output>
<fd:row-action id="raaddconversion" action-command="add-after">
<fd:label>+</fd:label>
</fd:row-action>
<fd:row-action id="radelconversion" action-command="delete">
<fd:label>-</fd:label>
</fd:row-action>
<fd:field id="fconvid">
<fd:label>Conv-ID</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="fsishortterm">
<fd:label>SI-Shortterm</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="fsifactor">
<fd:label>SI-Factor</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="fimpshortterm">
<fd:label>I-Shortterm</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:field id="fimpfactor">
<fd:label>I-Factor</fd:label>
<fd:datatype base="string"/>
</fd:field>
</fd:widgets>
</fd:repeater>
</fd:widgets>
</fd:repeater>
</fd:widgets>
</fd:form>
--------------------------------------------------
/* units_bind_xml.xml */
<fb:context
xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
path="/" >
<fb:repeater id="runits"
parent-path="units"
row-path="unit">
<fb:identity>
<fb:value id="oid" path="itemid">
<fd:convertor datatype="long" />
</fb:value>
</fb:identity> <fb:on-bind>
<fb:value id="fname" path="name" />
<fb:value id="fbaseconvid" path="baseconvid"/>
</fb:on-bind><fb:on-delete-row>
<fb:delete-node/>
</fb:on-delete-row>
<fb:repeater id="rconversions"
parent-path="unit"
row-path="conversion">
<fb:identity>
<fb:value id="oconvid" path="convid">
<fd:convertor datatype="long" />
</fb:value>
</fb:identity>
<fb:on-bind>
<fb:value id="fconvid" path="convid"/>
<fb:value id="fsishortterm" path="si/shortterm" mc="1"/>
<fb:value id="fsifactor" path="si/factor"/>
<fb:value id="fimpshortterm" path="imp/shortterm"/>
<fb:value id="fimpfactor" path="si/factor"/>
</fb:on-bind>
</fb:repeater>
</fb:repeater>
</fb:context>
thanks in advance, Richard
-- infolox gmbh Richard Schmid http://www.infolox.de
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
