I'm guessing that this is displayed multiple times using a JX forEach
loop, rather than a repeater?
that is correct. What benefit would there be to using a repeater over the method I am using?
I think just using an fd:multivaluefield should work;
No. Unfortunately this does not work, as it seems that at least one instance of the widget is required, where as in my case you will always start with zero items in a shopping cart, so there would be nothing to selectin the first instance. I also noticed that my checkbox was overwritten with a selection list box which is not what I want at all. I used the following:
widget:
<ft:widget id= "delItem">
<fi:styling value="${orderitem.getID()}" type="checkbox"/>
</ft:widget>
validation form:
<fd:multivaluefield id="delItem">
<fd:datatype base="string"/>
</fd:multivaluefield>
the widget will
take care of parsing the multiple values from the request into an Array
object. That would also simplify your flowscript since you'll always
get an Array rather than having to do the if/else for single vs.
multiple selection.
However, usually multivaluefield widgets have their individual checkbox
items generated from a selection-list, rather than by iterating manually
and calling ft:widget multiple times with different values. I'm not
sure how your approach will work with AJAX updates since it's a
nonstandard use of the widget.
A repeater in itself, also, is of no use to me as this, as you know, only allows me to repeat a number of other widgets an unspecified amount of times.
regards
Andrew
