Below is a test file for a possible bug when a bind is
applied to a trigger control. You can run this in the XForms sandbox to see what happens. See the XML comment just beneath the root element of the form for a description of the form, expected behavior, and unexpected behavior. If this isn't a bug I need to understand what I'm doing wrong relative to the control's bind statement. Thanks, Don ******************* <?xml version="1.0" encoding="utf-8"?> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <!-- Form contains four items, each with two properties: "selected" and "trigger". Values for "selected" are either 'true' or 'false' and values for "trigger" are either 'show' or 'hide'. Default values for each are, respectively, 'false' and 'show'. Bind statements apply to the "trigger" nodeset of items 1 and 2 making the nodeset relevant when the element's value is "show". Bind attributes are placed on the <trigger> controls of items 1 and 2 in the view. The select buttons for items 1 and 2 to disappear when items 3 or 4 are selected (as expected). However, the select buttons for items 1 and 2 no longer work at all (which is unexpected). Is this a bug? --> <xhtml:head> <xhtml:title>Test</xhtml:title> <xforms:model> <xforms:instance id="test-instance"> <test> <section1/> <section2> <list_A> <item_1> <selected>false</selected> <trigger>show</trigger> </item_1> <item_2> <selected>false</selected> <trigger>show</trigger> </item_2> <item_3> <selected>false</selected> <trigger>show</trigger> </item_3> <item_4> <selected>false</selected> <trigger>show</trigger> </item_4> </list_A> </section2> </test> </xforms:instance> <xforms:bind id="trigger_item_1" nodeset="/test/section2/list_A/item_1/trigger" relevant="/test/section2/list_A/item_1/trigger='show'"/> <xforms:bind id="trigger_item_2" nodeset="/test/section2/list_A/item_2/trigger" relevant="/test/section2/list_A/item_2/trigger='show'"/> </xforms:model> </xhtml:head> <xhtml:body> <xhtml:p >Test</xhtml:p> <xhtml:table border="1"> <xhtml:tr > <xhtml:td > </xhtml:td> <xhtml:td >Item 1</xhtml:td> <xhtml:td >Item 2</xhtml:td> <xhtml:td >Item 3</xhtml:td> <xhtml:td >Item 4</xhtml:td> </xhtml:tr> <xhtml:tr> <xhtml:td > </xhtml:td> <xhtml:td > <xforms:trigger bind="trigger_item_1"> <xforms:label>Select Item 1</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="section2/list_A/item_1/selected">true</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_1/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/trigger">hide</xforms:setvalue> </xforms:action> </xforms:trigger> </xhtml:td> <xhtml:td > <xforms:trigger bind="trigger_item_2"> <xforms:label>Select Item 2</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="section2/list_A/item_1/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/selected">true</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_1/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/trigger">hide</xforms:setvalue> </xforms:action> </xforms:trigger> </xhtml:td> <xhtml:td > <xforms:trigger > <xforms:label>Select Item 3</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="section2/list_A/item_1/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/selected">true</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_1/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/trigger">hide</xforms:setvalue> </xforms:action> </xforms:trigger> </xhtml:td> <xhtml:td > <xforms:trigger > <xforms:label>Select Item 4</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="section2/list_A/item_1/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/selected">true</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_1/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/trigger">hide</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/trigger">show</xforms:setvalue> </xforms:action> </xforms:trigger> </xhtml:td> </xhtml:tr> <xhtml:tr> <xhtml:td >Selected</xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_1/selected"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_2/selected"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_3/selected"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_4/selected"/> </xhtml:td> </xhtml:tr> <xhtml:tr> <xhtml:td >Trigger</xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_1/trigger"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_2/trigger"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_3/trigger"/> </xhtml:td> <xhtml:td> <xforms:output ref="instance('test-instance')/section2/list_A/item_4/trigger"/> </xhtml:td> </xhtml:tr> </xhtml:table> <xhtml:p> <xforms:trigger> <xforms:label>Reset All</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="section2/list_A/item_1/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_1/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_2/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_3/trigger">show</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/selected">false</xforms:setvalue> <xforms:setvalue ref="section2/list_A/item_4/trigger">show</xforms:setvalue> </xforms:action> </xforms:trigger> </xhtml:p> </xhtml:body> </xhtml:html> ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Don,
> If this isn't a bug I need to understand what I'm > doing wrong relative to the control's bind statement. it works if you set the xpath in the reference in an absolute way, eigther by using instance() or by adding the root-element: > <xforms:trigger bind="trigger_item_1"> > <xforms:label>Select Item 1</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:setvalue > ref="instance('test-instance')section2/list_A/item_1/selected">true</xforms:setvalue> > <xforms:setvalue > ref="/test/section2/list_A/item_2/selected">false</xforms:setvalue> > <xforms:setvalue So, the evaluation context may be different between the two trigger groups. HTH florian -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Florian,
Yes, that does the trick. Thanks. Now I'd like to understand why the XPath context is different. Thanks again. Don --- Florian Schmitt <[hidden email]> wrote: > Don, > > > If this isn't a bug I need to understand what I'm > > doing wrong relative to the control's bind > statement. > > it works if you set the xpath in the reference in an > absolute way, > eigther by using instance() or by adding the > root-element: > > > <xforms:trigger bind="trigger_item_1"> > > <xforms:label>Select Item 1</xforms:label> > > <xforms:action ev:event="DOMActivate"> > > <xforms:setvalue > > > > > <xforms:setvalue > > > > > <xforms:setvalue > > So, the evaluation context may be different between > the two trigger groups. > > HTH > florian > > > > -- > 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 > OW2 mailing lists service home page: > http://www.ow2.org/wws > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Don,
On Tue, May 13, 2008 at 4:38 AM, Don Smith <[hidden email]> wrote: > Now I'd like to understand why the XPath context is > different. The difference with the first 2 trigger is that you have a "bind" attribute on those. This binds the trigger to node specified, but also everything declared inside the trigger is evaluated in the context of that node. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Alex,
>This binds the trigger to node specified, but also > everything declared inside the trigger is evaluated > in the context of that node. OK. Thanks. Like XSLT, it's crucial to know your XPath context -- which I guess in XForms lingo is call the evaluation context. Is there a listing somewhere of the various XForm elements that *change* the evaluation context? I know, for example, that the <group> element sets a new evaluation context. Now I know that adding a bind attribute does so as well. Or is there a quick way to identify in the XForms specification which elements change the evaluation context? Thanks, Don -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Don,
On Fri, May 16, 2008 at 7:31 AM, Don Smith <[hidden email]> wrote: > Is there a listing somewhere of the various XForm > elements that *change* the evaluation context? I know, > for example, that the <group> element sets a new > evaluation context. Now I know that adding a bind > attribute does so as well. Or is there a quick way to > identify in the XForms specification which elements > change the evaluation context? There is some general verbiage in section 7.2 (http://www.w3.org/TR/xforms11/#expr-eval), but you will find more throughout the specification. See for instance section 10.3 for the <xforms:insert> (http://www.w3.org/TR/xforms11/#action-insert) which is one of the most complex cases. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |