Insert/Delete inside of xforms:select

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Insert/Delete inside of xforms:select

Kaex
This post was updated on .
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?
Reply | Threaded
Open this post in threaded view
|

Re: Insert/Delete inside of xforms:select

Erik Bruchez
Administrator
This error indicates that there is an attempt to set a value on an
element which contains another element.

I suspect this is the value of the select control. It points, via
car-list-bind, to CarList. Then, with insert, you insert an element
into CarList. The next time the value of the control changes, it tries
to write its value into CarList, which contains a nested element:
<car>.

To fix this, your control should point to an element which does not
contain nested elements, or to an attribute.

-Erik

On Tue, Dec 20, 2011 at 3:02 PM, Kaex <[hidden email]> wrote:

> 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.  Any ideas?
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Insert-Delete-inside-of-xforms-select-tp4219749p4219749.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Insert/Delete inside of xforms:select

Kaex
Thanks, that solved it! :)