cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: checkbox widget with datatype vector
Date Mon, 24 Jul 2006 13:45:09 GMT
Andrew wrote:
> 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>


Ah, now I see.  If I'd known this was what you were going for I wouldn't 
have recommended the selection-list approach.

I think you have a few choices:

1) Create your own custom styling for fi:multivaluefield that displays 
only a single checkbox where you set its value, sort of like you were 
doing before.

2) Bypass the ft:widget call altogether and just write out your own 
<input type="checkbox" name="delItem" value="${...}" /> for each row.

3) Use a repeater rather than the JX loop.  It sounds like you were 
trying to enable AJAX for this form, so this may be your best bet. 
Either of the first two choices above would be difficult to make work 
with CForms' AJAX framework.  Personally I think this is the cleanest 
approach.

> 
> <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?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message