cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <>
Subject Re: checkbox widget with datatype vector
Date Tue, 25 Jul 2006 15:52:10 GMT
Hi Jason,
we're nearly there! I've created the binding document, implemented it into
flow but no rows are being displayed when I update the order object!! What
am I overlooking?


var form = new Form("forms/artistOrder_new.xml");

        if (parseInt(bizData.quantity) || repeaterSize != 0) {
            try {

                if (repeaterSize != 0) { //Delete a row if need be
                    //delete a row and an item from the orderitem
                    for(var i=0; i < repeater.getSize(); i++) { //loop over
the rows
                      var row = repeater.getRow(i);

{ //is the booleanfield checked?
//add the item id to delete from widget

                        //now delete item row from repeater


                if (parseInt(bizData.quantity)) { //Add a row if need be
                    //add a row and an item to the orderitem
                    addOrderItem(bizData.quantity, bizData.orderID,

                    //Now add this item to the repeater


<?xml version="1.0"?>
<fb:context xmlns:fb=""

<fb:simple-repeater id="items" parent-path="."
row-path="neworder/orderItems" direction="load">
  <fb:value id="id" path="ID" />
  <fb:value id="artistName" path="artistName" />
  <fb:value id="itemTitle" path="Stock/ItemTitle" />
  <fb:value id="amount" path="Amount />
  <fb:value id="price" path="Price" />


jx file:

                                <td width="8" class="normaltext"></td>
                                <td class="normaltext"><ft:widget id="id"
                                <td width="8" class="normaltext"></td>
                                <td class="normaltext"><ft:widget
id="artistName" /></td>
                                <td width="8" class="normaltext"></td>
                                <td class="normaltext"><ft:widget
id="itemTitle" /></td>
                                <td class="normaltext"></td>
                                <td class="normaltext"><ft:widget
id="amount" /></td>
                                <td class="normaltext"></td>
                                <td class="normaltext"><ft:widget id="price"
                                <td class="normaltext"></td>
                                <td class="normaltext"><ft:widget
id="delete" /></td>


    <fd:repeater id="items" initial-size="0">
            <fd:output id="id">
                  <fd:datatype base="string" />
            <fd:output id="artistName">
                  <fd:datatype base="string" />
            <fd:output id="itemTitle">
                  <fd:datatype base="string" />
            <fd:output id="amount">
                  <fd:datatype base="string" />
            <fd:output id="price">
                  <fd:datatype base="string" />
            <fd:booleanfield id="delete" />



On 25/07/06, Jason Johnston <> wrote:
> Andrew wrote:
> > Hi Jason,
> > first off I have to say I appreciate the time you put into helping me
> > grasp these concepts, much appreciated.
> >
> No problem.
> >
> > So how in flow do I add values to each of the widgets, (id, artistName,
> > etc etc etc), in the repeater, and then add that row to
> <ft:repeater-rows>?
> Like I mentioned before, I think the easiest way to load data into the
> repeater is with a fb:simple-repeater binding.  I presume you're not
> familiar with the binding framework; it's basically a way to define (in
> an XML syntax) how to map values between a business object and the form
> object's widgets.  See the documentation:
> There's a special binding type called fb:simple-repeater (named such
> since it's much simpler than the full fb:repeater binding, but should be
> sufficient for your case) that lets you bind values from a Collection,
> Array, or anything else that JXPath can iterate over, to and from a
> fd:repeater widget and all its children.  Something like:
> In a binding file:
> ...
> <fb:simple-repeater id="items" parent-path="." row-path="orderItems"
>                      direction="load">
>    <fb:value id="id" path="ID" />
>    <fb:value id="artistName" path="..." />
>    ...
> </fb:simple-repeater>
> ...
> In your flow:
> form.createBinding("path/to/binding-file.xml"); //creates the binding
> ...
> form.load(neworder); //loads the data into the form using the binding
> That's it.  You can call form.load() as many times in your flow as you
> want, such as after you delete items or a new item is added.  As long as
> the orderItems list contains the up-to-date list of items, the repeater
> will be updated to match.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message