0
votes

I have encountered a glitch in Orbeon 2017.1 that did not occur in late 2015/early 2016 versions of the software: an error popup which has occurred when adding certain elements into the xforms:instance

Exception in client-side code. Message: l is undefined File: http://localhost:8080/orbeon/xforms-server/orbeon-266479e766510e28f420e559b3a49c43f8b18400.js Line number: 79

After a few hours of testing, I have narrowed it down to the following. When an xxforms:dialog appears within a repeated node (xforms:repeat), and new elements are added, the error occurs. Note that the error does not occur if the the element already exists by xforms-ready. To summarize my problem, I have a generic XBL component that will display an xxforms:dialog of attributes that can be edited, as derived dynamically by reading an XSD. This dialog can appear many places within an XForms application, for virtually any element. If the element in which the XBL is not repeatable (but added by DOMActivate), there is no error. Only in xforms:repeat.

<head>
    <xforms:model>
        <xforms:instance id="test">
            <model xmlns="http://null">
                <element1/>
            </model>
        </xforms:instance>

        <xforms:instance id="element2-template">
            <element2 xmlns="http://null"/>
        </xforms:instance>

        <xforms:instance id="element1-template">
            <element1 xmlns="http://null"/>
        </xforms:instance>
    </xforms:model>
    <xi:include href="dialog.xbl" xxi:omit-xml-base="true"/>
</head>
<body>
    <h1>Test</h1>
    <xforms:group ref="instance('test')">
        <div>
            <xforms:trigger appearance="minimal">
                <xforms:label>Insert Element1</xforms:label>
                <xforms:insert ev:event="DOMActivate" context="." nodeset="./child::node()[last()]" origin="instance('element1-template')"/>
            </xforms:trigger>
            <xforms:trigger appearance="minimal">
                <xforms:label>Insert Element2</xforms:label>
                <xforms:insert ev:event="DOMActivate" context="." nodeset="./child::node()[last()]" origin="instance('element2-template')"/>
            </xforms:trigger>
        </div>
        <div>
            <!-- this works: 
            <div>
                <xforms:input ref="my:element1">
                    <xforms:label>Element1</xforms:label>
                </xforms:input>
            </div>
            <my:dialog/>-->


            <xforms:repeat nodeset="my:element1">
                <div>
                    <xforms:input ref=".">
                        <xforms:label>Element1</xforms:label>
                    </xforms:input>                     
                </div>                  
                <!-- dialog does not work within newly added elements in a repeat on this level -->
                <my:dialog/>
            </xforms:repeat>

        <hr/>
        </div>
        <!-- this works: insert element 2 after xforms-ready -->
        <xforms:group ref="my:element2">
            <div>
                <xforms:input ref=".">
                    <xforms:label>Element1</xforms:label>
                </xforms:input>                     
            </div>
            <my:dialog/>
        </xforms:group>
    </xforms:group>
</body>

Here is the XBL:

<xbl:xbl xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
     xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:my="http://null">
    <xbl:binding id="my-dialog" element="my|dialog">
        <xbl:template>
            <xforms:group xbl:attr="model context ref bind" xxbl:scope="outer">
                <xbl:content includes="xforms|label,xforms|help,xforms|hint,xforms|alert"/>
                <xforms:group xxbl:scope="inner">
                    <xforms:var name="binding" as="node()?">
                        <xxf:sequence select="." xxbl:scope="outer"/>
                    </xforms:var>

                    <div>
                        Iside the XBL: 
                        <xforms:trigger appearance="minimal">
                            <xforms:label>Click for dialog</xforms:label>
                            <xforms:action ev:event="DOMActivate">
                                <xxf:show dialog="element-attributes"/>
                            </xforms:action>
                        </xforms:trigger>
                    </div>

                    <xxf:dialog id="element-attributes" appearance="full" level="modal" close="true" draggable="true" visible="false">
                        <xforms:label>Dialog</xforms:label>
                        <div>Here's the dialog text</div>
                    </xxf:dialog>
                </xforms:group>
            </xforms:group>
        </xbl:template>
    </xbl:binding>
</xbl:xbl>

This form will load without errors. You can click the "Click for dialog" trigger in the XBL portion to show the xxforms:dialog because element1 is already in the model. However, if you click the trigger to add another element1, there will be an error dialog in client-side code. If you click the trigger to add element2, there's no error because element2 is not repeatable. You can therefore click the "Click for dialog" within element2 and the xxforms:dialog will appear.

Is there a workaround for this, or is this a bug in the current version of Orbeon? It did work in the version I ran earlier in 2017.

1

1 Answers

0
votes

Indeed, the issue you reported does exist in Orbeon Forms 2017.2 (and maybe earlier version). This issue is now fixed, and the fix will be included 2018.1 and subsequent releases, as well as in 2017.2.1.