setting the multivaluefield datatype to integer did the trick. I guess it is the "key" (or value - depends how you look at it) datatype that matters here, not the label.

Jorg Heymans wrote:
Hi,

I have a bean called "Profile" that populates my form. The bean has an arraylist called "targetGroups" which contains "TargetGroup" objects. (and get-set methods for this arraylist)
Each Targetgroup object has an id(Integer) and name(String).


i have a multivaluefield widget for these groups

<fd:multivaluefield id="targetgroups">
<!--is this datatype correct???? tried setting it to my TargetGroup class but it says unknown datatype -->
<fd:datatype base="string"/>
<fd:selection-list/>
</fd:multivaluefield>


I want to populate this multivaluefield with a custom binding

<fb:javascript id="targetgroups" path="targetGroups" direction="load">
  <fb:load-form>
    var collection = jxpathPointer.getNode();
    widget.setSelectionList(collection, "id", "name");
  </fb:load-form>
</fb:javascript>

I am getting a ClassCastException

Original Exception: java.lang.ClassCastException
at org.apache.cocoon.forms.datatype.convertor.DummyStringConvertor.convertToString(DummyStringConvertor.java:35)


at org.apache.cocoon.forms.datatype.typeimpl.AbstractDatatype.convertToString(AbstractDatatype.java:94)

at org.apache.cocoon.forms.datatype.FlowJXPathSelectionList.generateSaxFragment(FlowJXPathSelectionList.java:119)

at org.apache.cocoon.forms.formmodel.MultiValueField.generateItemSaxFragment(MultiValueField.java:143)

at org.apache.cocoon.forms.formmodel.AbstractWidget.generateSaxFragment(AbstractWidget.java:369)

at org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe$WidgetHandler.process(EffectWidgetReplacingPipe.java:390)

at org.apache.cocoon.forms.transformation.EffectPipe.endElement(EffectPipe.java:417)

at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source



Thoughts? Jorg


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



Reply via email to