Richard,
* you would probably want to check in flow if the binding worked before asking to showForm() the thing form.lookupWidget("path-expression").getValue() might be helpful
* by default logging level on the various aspects of cocoon has a quite high treshold, you'ld need to change logkit.xconf (in build/webapp/WEB-INF) to read e.g.
<category log-level="DEBUG" name="forms"> <log-target id-ref="forms"/> <log-target id-ref="error"/> </category>
after witch you can check the file forms.log (in build/webapp/WEB-INF/logs)
you'll get quite a big list of statements out of this, happy reading ;-)
* alternatively you could also remotely connect to the jetty-vm and step-debug (e.g with eclipse)
* snippets of what we did: (although I think this is less useful)
-- definition: <fd:repeater id="results"> <fd:widgets> <fd:output id="title"> <fd:datatype base="string"/> </fd:output>
<fd:repeater id="res"> <fd:widgets> <fd:output id="id"> <fd:datatype base="long"/> </fd:output> <fd:repeater id="resLines"> <fd:widgets> <fd:output id="id"> <fd:datatype base="long"/> </fd:output> <fd:output id="veCode"> <fd:label>ve</fd:label> <fd:datatype base="string"/> </fd:output> <fd:output id="beginDate"> <fd:label>van</fd:label> <fd:datatype base="date"/> </fd:output> <fd:output id="endDate"> <fd:label>tot</fd:label> <fd:datatype base="date"/> </fd:output>
<fd:submit id="editReservation" action-command="viewRes"> <fd:label>Bekijken</fd:label> </fd:submit> </fd:widgets> </fd:repeater> </fd:widgets> </fd:repeater>
</fd:widgets> </fd:repeater>
-- binding <fb:repeater id="results" parent-path="." row-path="results"> <fb:identity><fb:value path="title" id="title"/></fb:identity> <fb:on-bind>
<fb:repeater id="res" parent-path="." row-path="reservations">
<fb:identity><fb:value path="@id" id="id"/></fb:identity>
<fb:on-bind>
<fb:value id="id" path="id" direction="load"/>
<fb:repeater id="resLines" parent-path="." row-path="reservationLines">
<fb:identity><fb:value path="@id" id="id"/></fb:identity>
<fb:on-bind>
<fb:value id="veCode" path="ve/code" direction="load"/>
<fb:value id="beginDate" path="beginDate" direction="load"/>
<fb:value id="endDate" path="endDate" direction="load"/>
</fb:on-bind>
</fb:repeater>
</fb:on-bind>
</fb:repeater>
</fb:on-bind> </fb:repeater>
-- template <table> <tr> <ft:repeater-widget id="results"> <td valign="top">
<table class="result_table" cellpadding="0" cellspacing="0"> <caption><ft:widget id="title"/></caption> <tr> <td class="label result_head" valign="bottom">ve</td> <td class="label result_head" valign="bottom">van</td> <td class="label result_head" valign="bottom">tot</td> <td class="label result_head" valign="bottom">acties</td> </tr>
<ft:repeater-widget id="res">
<ft:repeater-widget id="resLines">
<tr class="result_row">
<td class="result_data">
<ft:widget id="veCode"/>
</td>
<td class="result_data">
<ft:widget id="beginDate"/>
</td>
<td class="result_data">
<ft:widget id="endDate"/>
</td>
<td class="result_data">
<ft:widget id="editReservation"><fi:styling type="image" class="action" src="icon/edit_12.gif"/></ft:widget>
</td>
</tr>
</ft:repeater-widget>
<tr class="result_separator"><td colspan="4"/></tr>
</ft:repeater-widget>
</table>
</td> </ft:repeater-widget> </tr> </table>
resulting in
one column per 'result' in which we get different rows that each represent a 'reservation-line' which are grouped in 'reservations' that got marked by an intermediate separator-line (css on the [EMAIL PROTECTED]'result_separator'])
-- backend
set of java classes of which you can deduce appropriate getters/setters from the binding above.
HTH -marc=
Richard Schmid wrote:
Marc Portier wrote:
Richard,
I have some nested repeaters working (definition and binding to beans) in a smaller app. What exactly is not working for you?
(I must admit I haven't tried nesting the widget-labels nor the actions, both could be subject to some required patching, details of what goes wrong (stacktraces?) or contrary to your expectations might be useful)
regards, -marc=
Richard Schmid wrote:
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
Hello Marc,
thanks for answering - i've attached a screenshot of what is rendered with the given configuration.
the result should be:
data in the nested Table/Repeater (only headers are shown), and action-buttons
I'm using xml-binding and didn't want to use bean-binding (since i would like to avoid beans for now). I don't see error-messages - to me it looks like it's unsupported.
could you give me snippets of your working configuration?
thanks, Richard
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://blogs.cocoondev.org/mpo/ [EMAIL PROTECTED] [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]