xxforms:script is not executed when oxf.xforms.cache.documents.size is small

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

xxforms:script is not executed when oxf.xforms.cache.documents.size is small

James Gu
This post was updated on .
Hi,

I use Orbeon Forms Release 3.7.0beta1.200808240812 to build our web application.

I found that xxforms:script doesn't work in this case. These are the steps.

1. I open a browser (IE) and log into our web application, open an xhtml page. There is a trigger on the page. I added xxforms:script when users clicks on the trigger. It works well.

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
    <xhtml:head>
        <xhtml:title>aaa</xhtml:title>
        <xforms:model>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>

        <xforms:trigger>
            <xforms:label>testButton</xforms:label>
            <xforms:action ev:event="DOMActivate">
                <xforms:message>
                    before script
                </xforms:message>
                <xxforms:script>
                    alert("test");
                </xxforms:script>
                <xforms:message>
                    after script
                </xforms:message>
            </xforms:action>
        </xforms:trigger>

    </xhtml:body>
</xhtml:html>

2. I open another browser (firefox) and log into the wen application. Navigate on some pages.

3. I switch back to the first browser and click on the trigger again. The xforms:script is not executed.


I tried to debug the code and found that it is related with property "oxf.xforms.cache.documents.size".

    <property as="xs:integer" name="oxf.xforms.cache.documents.size"                 value="10"/>

In step 1, when we load the page, a XFormsContainingDocument object is created and added to cache in XFormsToXHTML.java. If user clicks on the button, the orbeon framework fires a AJAX to server. It will get the XFormsContainingDocument from cache and do calculation. In the response, there is action for the xxforms:script, so the browser will execute it.

In step 1, we navigate some pages in the second browser. It will replace all cached document.

In step 3, when I click on the trigger again. The original cached XFormsContainingDocument is missing and Orbeon tries to create a new XFormsContainingDocument. I compare the new object with the old one. The new one doesn't contain xxforms:script in xforms controls. I guess that the different is the XFormsState object we pass in when we create XFormsContainingDocument.

Do you have any suggestion on this?

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: xxforms:script is not executed when oxf.xforms.cache.documents.size is small

Alessandro  Vernet
Administrator
Hi James,

By now, 3.7 is a very old version. Even if you don't wish to upgrade, can you reproduce this problem with 4.3? If that is the case, we might be able to help you through this forum, otherwise, you'll most likely want to consider to upgrade.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: xxforms:script is not executed when oxf.xforms.cache.documents.size is small

James Gu
Alex,

I tried 4.3 and I can't recreate the error. It seems to be fixed in 4.3. I will consider a upgrade.

Thanks,
James