XForms dispatch does not pass custom properties if a delay is specified

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

XForms dispatch does not pass custom properties if a delay is specified

Toon Andries-2
Hi,

I stumbled on what seems like a bug today.

If you have a form that uses an xf:dispatch that has an xf:property child element, the property can be retrieved with event('property-name').
However, if you also have the @delay attribute specified on the xf:dispatch, then the property is no longer passed and event('property-name') returns an empty string.

Here is an example page:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xhtml:html xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xxf="http://orbeon.org/oxf/xml/xforms">
    <xhtml:head>
        <xhtml:title>Delay with property</xhtml:title>
        <xf:model id="m-default">
            <xf:instance id="i-default">
                <default xmlns="">
                    <output>Default</output>
                </default>
            </xf:instance>
            <xf:action ev:event="e-message">
                <xf:setvalue ref="instance('i-default')/output" value="event('message')" />
                <xf:message level="xxf:log-warn">Message: <xf:output value="event('message')" /></xf:message>
            </xf:action>
        </xf:model>
    </xhtml:head>
    <xhtml:body>
        <xhtml:h3>
            <xf:output ref="instance('i-default')/output" />
        </xhtml:h3>
        <xf:trigger>
            <xf:label value="'I will send a message'" />
            <xf:dispatch ev:event="DOMActivate" target="m-default" name="e-message" delay="3000">
                <xf:property name="message" value="'Test message'" />
            </xf:dispatch>
        </xf:trigger>
    </xhtml:body>
</xhtml:html>

  • If you run this example, you will notice that after 3 seconds, the h3 output will disappear, but a message is printed in the log (however, without the content of the message!).
  • Remove the delay attribute and run the example again. If you click the button, the h3 output is immediately changed to "Test message" and a message is logged "Message: Test message".
  • Put the delay attribute back and remove the property, and after 3 seconds the h3 output will disappear (as expected) and the message is printed in the log (however, without the content of the message, as expected).
  • I have tested the same with the delay as child element of xf:dispatch, as described in the XForms 2.0 spec, but here the problem is with the delay element. The message is then printed from the property, but without delay.(http://www.w3.org/TR/xforms20/#The_delay_Child_Element)


Kind regards,

Toon Andries
Professional Service Consultant
Inventive Designers

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: XForms dispatch does not pass custom properties if a delay is specified

Erik Bruchez
Administrator
Toon,

It does seem like a bug/limitation. If you check the code here:

    http://goo.gl/ljm1fK

you'll see that the properties are completely ignored when there is a delay. They should be serialized.

This could pose some issues as we encrypt and send such events to the browser, if the data is large. But we could possibly restrict what can be serialized (types and size).

Do you have a workaround or are you looking for a fix?

(We don't support the nested xf:delay element.)

-Erik