You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christofer Dutz <du...@c-ware.de> on 2005/05/28 13:44:09 UTC
Updating repeater values?
Hi,
After solving all my other problems I am working on a simple
shoping-cart repeater.
Unfortunately I am not able to update any values. Could you give me a
hint on what I am doing wrong?
The "cart" Variable is a simple W3c Dom object, which I initiaise with
some test-data in the Flowscripts
Init-Method. Here the relevant files.
Flowscript:
cartForm.load(cart);
cartForm.showForm("shop/shoppingCartTemplate.jexl");
cartForm.save(cart);
Form:
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
<fd:widgets>
<fd:repeater id="cartContent" initial-size="0">
<fd:label>Warenkorb:</fd:label>
<fd:widgets>
<fd:field id="count" requried="true">
<fd:label>Anzahl:</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:output id="product">
<fd:label>Artikel:</fd:label>
<fd:datatype base="string"/>
</fd:output>
<fd:output id="productNo">
<fd:label>Bestellnummer:</fd:label>
<fd:datatype base="string"/>
</fd:output>
<fd:output id="price">
<fd:label>Einzelpreis:</fd:label>
<fd:datatype base="string"/>
</fd:output>
<fd:output id="totalPrice">
<fd:label>Gesamtpreis:</fd:label>
<fd:datatype base="string"/>
</fd:output>
</fd:widgets>
</fd:repeater>
<fd:submit id="updateButton" validate="true">
<fd:label>Aktualisieren</fd:label>
</fd:submit>
<fd:submit id="nextButton" validate="true">
<fd:label>Weiter</fd:label>
</fd:submit>
</fd:widgets>
</fd:form>
Template:
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
<title>Warenkorb</title>
<include src="/shop/utils/forms-lib.js"/>
<paragraph style="width:990px;height:445px">
<ft:form-template action="#{$continuation/id}.continue"
method="POST">
<paragraph style="width:990px;height:385px">
<br/>
<table style="width:990px;text-align:left;font-size:16px">
<row>
<cell style="width:13px;text-align:right">
<image url="/images/popup-button-left.gif"/>
</cell>
<cell style="background-color:rgb(60,70,131)">
<ft:repeater-widget-label id="cartContent"
widget-id="count"/>
</cell>
<cell style="background-color:rgb(60,70,131)">
<ft:repeater-widget-label id="cartContent"
widget-id="product"/>
</cell>
<cell style="background-color:rgb(60,70,131)">
<ft:repeater-widget-label id="cartContent"
widget-id="productNo"/>
</cell>
<cell style="background-color:rgb(60,70,131)">
<ft:repeater-widget-label id="cartContent"
widget-id="price"/>
</cell>
<cell style="background-color:rgb(60,70,131)">
<ft:repeater-widget-label id="cartContent"
widget-id="totalPrice"/>
</cell>
<cell style="width:13px">
<image url="/images/popup-button-right.gif"/>
</cell>
</row>
<ft:repeater-widget id="cartContent">
<row>
<cell/>
<cell>
<ft:widget id="count"/>
</cell>
<cell>
<ft:widget id="product"/>
</cell>
<cell>
<ft:widget id="productNo"/>
</cell>
<cell>
<ft:widget id="price"/>
</cell>
<cell>
<ft:widget id="totalPrice"/>
</cell>
<cell/>
</row>
</ft:repeater-widget>
<row>
<cell/>
<cell
style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
colspan="4" align="right">Gesamt Bestellwert:</cell>
<cell
style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
align="right">orderValue</cell>
<cell/>
</row>
<row>
<cell/>
<cell colspan="4" align="right">Porto &
Verpackung (frei ab 100,00 Bestellwert):</cell>
<cell align="right">0.00</cell>
<cell/>
</row>
<row>
<cell/>
<cell
style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
colspan="4" align="right">Gesamtpreis:</cell>
<cell
style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
align="right">0.00</cell>
<cell/>
</row>
</table>
</paragraph>
<paragraph style="width:570px;height:35px;margin-left:420px">
<table style="width:570px;empty-cells:show">
<row>
<cell style="width:190px;tex-align:center">
<ft:widget id="updateButton">
<fi:styling type="image"
src="/images/buttons/Aktualisieren.png"/>
</ft:widget>
</cell>
<cell style="width:190px;tex-align:center">
</cell>
<cell style="width:190px;tex-align:center">
<ft:widget id="nextButton">
<fi:styling type="image"
src="/images/buttons/Weiter.png"/>
</ft:widget>
</cell>
</row>
</table>
</paragraph>
</ft:form-template>
</paragraph>
</page>
Binding:
<?xml version="1.0" encoding="UTF-8"?>
<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
path="/cart/cartContent">
<fb:repeater id="cartContent" parent-path="content" row-path="product">
<fb:identity id="productNo" path="productNo"/>
<fb:on-bind>
<fb:value id="count" path="count"/>
<fb:value id="product" path="product"/>
<fb:value id="productNo" path="productNo"/>
<fb:value id="price" path="price"/>
<fb:value id="totalPrice" path="totalPrice"/>
</fb:on-bind>
</fb:repeater>
</fb:context>
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Updating repeater values?
Posted by Christofer Dutz <du...@c-ware.de>.
Let me be a little more specific: Cocoon displays a text field for count
and if I change the value and click on the update-button the changes
dont get stored in the cart-document.
Christofer Dutz wrote:
> Hi,
>
> After solving all my other problems I am working on a simple
> shoping-cart repeater.
> Unfortunately I am not able to update any values. Could you give me a
> hint on what I am doing wrong?
>
> The "cart" Variable is a simple W3c Dom object, which I initiaise with
> some test-data in the Flowscripts
> Init-Method. Here the relevant files.
>
> Flowscript:
> cartForm.load(cart);
> cartForm.showForm("shop/shoppingCartTemplate.jexl");
> cartForm.save(cart);
>
> Form:
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
> <fd:widgets>
> <fd:repeater id="cartContent" initial-size="0">
> <fd:label>Warenkorb:</fd:label>
> <fd:widgets>
> <fd:field id="count" requried="true">
> <fd:label>Anzahl:</fd:label>
> <fd:datatype base="string"/>
> </fd:field>
> <fd:output id="product">
> <fd:label>Artikel:</fd:label>
> <fd:datatype base="string"/>
> </fd:output>
> <fd:output id="productNo">
> <fd:label>Bestellnummer:</fd:label>
> <fd:datatype base="string"/>
> </fd:output>
> <fd:output id="price">
> <fd:label>Einzelpreis:</fd:label>
> <fd:datatype base="string"/>
> </fd:output>
> <fd:output id="totalPrice">
> <fd:label>Gesamtpreis:</fd:label>
> <fd:datatype base="string"/>
> </fd:output>
> </fd:widgets>
> </fd:repeater>
> <fd:submit id="updateButton" validate="true">
> <fd:label>Aktualisieren</fd:label>
> </fd:submit>
> <fd:submit id="nextButton" validate="true">
> <fd:label>Weiter</fd:label>
> </fd:submit>
> </fd:widgets>
> </fd:form>
>
> Template:
> <page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
> <title>Warenkorb</title>
> <include src="/shop/utils/forms-lib.js"/>
> <paragraph style="width:990px;height:445px">
> <ft:form-template action="#{$continuation/id}.continue"
> method="POST">
> <paragraph style="width:990px;height:385px">
> <br/>
> <table style="width:990px;text-align:left;font-size:16px">
> <row>
> <cell style="width:13px;text-align:right">
> <image url="/images/popup-button-left.gif"/>
> </cell>
> <cell style="background-color:rgb(60,70,131)">
> <ft:repeater-widget-label id="cartContent"
> widget-id="count"/>
> </cell>
> <cell style="background-color:rgb(60,70,131)">
> <ft:repeater-widget-label id="cartContent"
> widget-id="product"/>
> </cell>
> <cell style="background-color:rgb(60,70,131)">
> <ft:repeater-widget-label id="cartContent"
> widget-id="productNo"/>
> </cell>
> <cell style="background-color:rgb(60,70,131)">
> <ft:repeater-widget-label id="cartContent"
> widget-id="price"/>
> </cell>
> <cell style="background-color:rgb(60,70,131)">
> <ft:repeater-widget-label id="cartContent"
> widget-id="totalPrice"/>
> </cell>
> <cell style="width:13px">
> <image url="/images/popup-button-right.gif"/>
> </cell>
> </row>
> <ft:repeater-widget id="cartContent">
> <row>
> <cell/>
> <cell>
> <ft:widget id="count"/>
> </cell>
> <cell>
> <ft:widget id="product"/>
> </cell>
> <cell>
> <ft:widget id="productNo"/>
> </cell>
> <cell>
> <ft:widget id="price"/>
> </cell>
> <cell>
> <ft:widget id="totalPrice"/>
> </cell>
> <cell/>
> </row>
> </ft:repeater-widget>
> <row>
> <cell/>
> <cell
> style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
> colspan="4" align="right">Gesamt Bestellwert:</cell>
> <cell
> style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
> align="right">orderValue</cell>
> <cell/>
> </row>
> <row>
> <cell/>
> <cell colspan="4" align="right">Porto &
> Verpackung (frei ab 100,00 Bestellwert):</cell>
> <cell align="right">0.00</cell>
> <cell/>
> </row>
> <row>
> <cell/>
> <cell
> style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
> colspan="4" align="right">Gesamtpreis:</cell>
> <cell
> style="border-top-width:1px;border-top-style:solid;border-color:#CCCC99"
> align="right">0.00</cell>
> <cell/>
> </row>
> </table>
> </paragraph>
> <paragraph style="width:570px;height:35px;margin-left:420px">
> <table style="width:570px;empty-cells:show">
> <row>
> <cell style="width:190px;tex-align:center">
> <ft:widget id="updateButton">
> <fi:styling type="image"
> src="/images/buttons/Aktualisieren.png"/>
> </ft:widget>
> </cell>
> <cell style="width:190px;tex-align:center">
> </cell>
> <cell style="width:190px;tex-align:center">
> <ft:widget id="nextButton">
> <fi:styling type="image"
> src="/images/buttons/Weiter.png"/>
> </ft:widget>
> </cell>
> </row>
> </table>
> </paragraph>
> </ft:form-template>
> </paragraph>
> </page>
>
> Binding:
> <?xml version="1.0" encoding="UTF-8"?>
> <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"
> path="/cart/cartContent">
> <fb:repeater id="cartContent" parent-path="content"
> row-path="product">
> <fb:identity id="productNo" path="productNo"/>
> <fb:on-bind>
> <fb:value id="count" path="count"/>
> <fb:value id="product" path="product"/>
> <fb:value id="productNo" path="productNo"/>
> <fb:value id="price" path="price"/>
> <fb:value id="totalPrice" path="totalPrice"/>
> </fb:on-bind>
> </fb:repeater>
> </fb:context>
>
>
> Chris
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org