Insert/Delete inside of xforms:select
Posted by Kaex on
URL: https://discuss.orbeon.com/Insert-Delete-inside-of-xforms-select-tp4219749.html
I'm currently trying to implement a multi-select control that inserts and delete elements from my instance on select/deselect. This works fine on the first selection, but on subsequent selections I'm getting the following error from Orbeon: "Unable to set value on complex content line 0".
My instance:
<Catalog>
<CarList/>
</Catalog>
My xforms:
<xforms:select appearance="compact" id="car-list-control" bind="car-list-bind">
<xforms:label ref="$form-resources/carList/label" />
<xforms:itemset nodeset="$form-resources/carList/item">
<xforms:label ref="label" />
<xforms:value ref="value" />
</xforms:itemset>
<xforms:insert ev:event="xforms-select" context="instance()/CarList"
origin="xxforms:element('car', event('xxforms:item-value'))"/>
<xforms:delete ev:event="xforms-deselect" context="instance()/CarList"
ref="*[car = event('xxforms:item-value')]"/>
</xforms:select>
My binding:
<xforms:bind id="car-list-bind" nodeset="CarList" />
Ideally, this would insert <car /> elements in my instance based on the selected items. What am I doing wrong?