Search code examples
orbeonxforms

Getting Error while clicking on a button in Orbeon Form


I am getting an error which is not expected as per the code.

This is the error i am getting.

Attempting to access a sequence as a singleton item (org.orbeon.saxon.trans.XPathException)

This is my Add button Code:

<xforms:trigger appearance="minimal" id="repeat-add-id" ref=".[$summary='false' and instance('abc-instance')/product/accounts]">
    <xforms:label>
        <span class="input-label">Add</span>
    </xforms:label>
    <xforms:action ev:event="DOMActivate">
        <xforms:insert nodeset="instance('abc-instance')/product/accounts[last()&lt;10]"
            origin="instance('abc-instance-template')/product/accounts" />
        <!-- <xforms:message modal="level">Xforms Message</xforms:message> -->
</xforms:trigger>

This is my summary variable defnition

<xxforms:variable name="summary" select="instance('abc-attributes')/form-global/summary"/>

If i remove the insert command in <xforms:action> it will not show the error dialog box.

Any help is appreciated.


Solution

  • I found the problem. There is nothing wrong with the code in the trigger itself. I am using xxforms:valid() for the nodeset instance('abc-instance')/product/accounts in later part of code. On the first run, since there is only one node, and so there are no errors. However When I click add button link, there are 2 nodes, but the xxforms:valid() expects a single node, hence the error message.

    Summary:

    So the bottom line here is, when you see this error "Attempting to access a sequence as a singleton item", that means there are some functions in your form which are expecting a single node are parameter but there exists more than one.