I have noticed that the xforms server fires two duplicate events if you reference a specific instance element from a xforms:group ref="" statement (and use ref="." on the input control).
If you instead place the reference on the input control, then only a single event fires. I have noticed this in both 'xforms-value-changed' and 'xforms-valid'. The following code demonstrates this (where the third event is raised twice). <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"> <xhtml:head> <xforms:model> <xforms:instance id="controls"> <testcontrols> <testcontrol/> </testcontrols> </xforms:instance> </xforms:model> </xhtml:head> <xhtml:body> Test 1 <xforms:group> <xforms:action ev:event="xforms-value-changed"> <xforms:message level="modal">xforms-value-changed (1)</xforms:message> </xforms:action> <xforms:input ref="instance('controls')/testcontrol"/> </xforms:group> <xhtml:br/> Test 2 <xforms:group ref="instance('controls')/testcontrol"> <xforms:action ev:event="xforms-value-changed"> <xforms:message level="modal">xforms-value-changed (2)</xforms:message> </xforms:action> <xforms:input ref="."/> </xforms:group> </xhtml:body> </xhtml:html> Chris. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Chris,
Good catch. This happens because we dispatch an xforms-value-changed for the group. I don't think we should since a group doesn't have a value, so I committed a fix which prevents sending such events to any control that doesn't have a value. Now one question is whether an xforms:group should receive relevance and read-only events. -Erik [hidden email] wrote: > I have noticed that the xforms server fires two duplicate events if you reference a specific instance element from a xforms:group ref="" statement (and use ref="." on the input control). > > If you instead place the reference on the input control, then only a single event fires. > I have noticed this in both 'xforms-value-changed' and 'xforms-valid'. > > The following code demonstrates this (where the third event is raised twice). > > <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"> > > <xhtml:head> > > <xforms:model> > <xforms:instance id="controls"> > <testcontrols> > <testcontrol/> > </testcontrols> > </xforms:instance> > </xforms:model> > > </xhtml:head> > > <xhtml:body> > Test 1 > <xforms:group> > <xforms:action ev:event="xforms-value-changed"> > <xforms:message level="modal">xforms-value-changed (1)</xforms:message> > </xforms:action> > > <xforms:input ref="instance('controls')/testcontrol"/> > </xforms:group> > > <xhtml:br/> > Test 2 > <xforms:group ref="instance('controls')/testcontrol"> > <xforms:action ev:event="xforms-value-changed"> > <xforms:message level="modal">xforms-value-changed (2)</xforms:message> > </xforms:action> > > <xforms:input ref="."/> > </xforms:group> > </xhtml:body> > > </xhtml:html> > > Chris. > > -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |