Hi,
all is working now, but.......

Ok, so I have a jx loop which pulls in all of the orderitem details required to be displayed to a user:

<jx:forEach var="orderitem" items="${neworder.getOrderItems ()}">
                      <tr>
                        <td width="8" class="normaltext"></td>
                        <td class="normaltext">${orderitem.getID ()}</td>
                        <td width="8" class="normaltext"></td>
                        <td class="normaltext">${orderitem.getArtistName()}</td>
                        <td width="8" class="normaltext"></td>
                        <td class="normaltext">${orderitem.getStock().getItemTitle()}</td>
                        <td class="normaltext"></td>
                        <td class="normaltext">${orderitem.getAmount()}</td> 
                        <td class="normaltext"></td>
                        <td class="normaltext">${ orderitem.getPrice()}.00</td>
                        <td class="normaltext"></td>
                        <td class="normaltext">
                        <ft:widget id= "delItem">
                            <fi:styling list-type="checkbox"/> //MultiValueField
                        </ft:widget>
                        </td>               
                      </tr>
                      </jx:forEach>

<fd:multivaluefield id="delItem">
      <fd:datatype base="string"/>
      <fd:selection-list nullable="false" type="flow-jxpath" list-path="neworder/orderItems" value-path="ID" label-path="''" />
    </fd:multivaluefield>

Having the delItem widget in the table now means that for every item in the users cart, 1 extra checkbox will be displayed for that orderitem, because I basically have a loop within a loop! So basically what I need is a widget that will allow me to create a table like the one above, minus the final mulivaluefield widget, pulling in all orderitems from one source instead of two sources like above. Is this possible?

The solution I had before using jx to iterate through an object does not work as there is no fd:validation which can handle a number of fields with the same id that is not generated by a multivaluefield. Also the multvaluefield option does not work as it will give me a list of checkboxes based on the number of items within an object. There is then no way to marry the checkboxes with other items, as I have, displayed by a jx loop which itself iterates through the same object as the multivaluefield. Any solution here at all?

regards

Andrew

On 24/07/06, Andrew <[EMAIL PROTECTED]> wrote:
Ok,
what I needed was:

form.lookupWidget("widgetid").value

So what gives with var model = form.getModel()? Does getModel not pick up all the widgets, and model.widgetid not simply pull the value out of the widget?


regards

Andrew

On 24/07/06, Andrew < [EMAIL PROTECTED]> wrote:
Hi,


        var model = form.getModel();
        var bizData = {"next" : model.next, "delItem" : model.delItem, "quantity" : model.quantity, "orderID" : model.orderID, "stockID" : model.stockID}
        var confirmOrder = bizData.next;
        var delItems2 = bizData.delItem; //The list of selected checkboxes
        var delItems = java.util.Arrays.asList(delItems2);

The above gives me the follwoing error:

Cannot convert [EMAIL PROTECTED] to java.lang.Object[]

So when I do:

var delItems = java.util.Arrays.asList(delItems2.getValue ());

I get the follwoing error message:

getValue is not a function.

What am I missing here?

regards

Andrew



On 24/07/06, Andrew <[EMAIL PROTECTED]> wrote:
Hi Jason,
my bad! bizdata is represented as follows in flow:

        var model = form.getModel();
        var bizData = {"next" : model.next, "delItem" : model.delItem, "quantity" : model.quantity, "orderID" : model.orderID, "stockID" : model.stockID}
        var confirmOrder = bizData.next;

        delItems = bizData.delItem;
        var items = new java.util.Vector();
       
        if (parseInt(bizData.quantity) || delItems != null) {
            try {
             
                if (delItems != null) {
               
                   if ( delItems.iterator) {
                      items.addAll(delItems);
                      deleteOrderItem2(items);
                   } else {
                      items.add(delItems);
                      deleteOrderItem2(items);
                   }
                }

HTH

regards

Andrew


On 23/07/06, Jason Johnston < [EMAIL PROTECTED]> wrote:
>      >
>      > Again the flow code is unchanged:
>      >
>      >         delItems = bizData.delItem ;
>      >         var items = new java.util.Vector();
>
>
> As delItems is now actually a widget, why can I not do this to extract
> the value of the widget?:
>
> delItems = bizData.delItem.value;
>

Sorry, I'm working with an incomplete picture here... I don't know what
bizData is or what bizData.delItem returns.  If it's the actual widget
then yes, you should be able to do .value to get its value.  That value
will be a Java String[] array, so if you have to get that into a Vector
or Collection to satisfy whatever API you're passing it to then you'll
need a conversion something like what I wrote in my previous reply.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





Reply via email to