Hi all,
With an auto-complete control we have to use by design the same element for the label and the value node of the itemset. Ex : <xforms:itemset nodeset="itemset/item"> <xforms:label ref="."/> <xforms:value ref="."/> </xforms:itemset> With : <itemset> <item id="1"> First </item> <item id="2"> Second </item> <item id="3"> Third </item> </itemset> How can I retrieve the id of the selected element ? Marc -- 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 |
Marc,
I'm not sure why you can't store the value as @id, but assuming the value of the item elements are unique you could use <xforms:setvalue ref="instance('some-instance')/path/to/id/element" value="for $i in instance('some-instance')/path/to/selected/item return /itemset/item[. = $i]/@id"/> Assuming you want to set the value to an element Ryan Ryan Puddephatt Software Engineer TFX Group - IT UK 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: [hidden email] [mailto:[hidden email]] >Sent: 11 July 2006 14:45 >To: [hidden email] >Subject: [ops-users] Auto-complete return value > >Hi all, > >With an auto-complete control we have to use by design the same element >for the label and the value node of the itemset. > >Ex : > ><xforms:itemset nodeset="itemset/item"> > <xforms:label ref="."/> > <xforms:value ref="."/> ></xforms:itemset> > >With : > > <itemset> > <item id="1"> > First > </item> > <item id="2"> > Second > </item> > <item id="3"> > Third > </item> > </itemset> > >How can I retrieve the id of the selected element ? > >Marc -- 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 |
In reply to this post by Marc.Benimeli
Ryan,
>I'm not sure why you can't store the value as @id, but assuming the value of the item elements are unique you could use Because by design if you put the @id in the value, the control will display the @id element. ><xforms:setvalue ref="instance('some-instance')/path/to/id/element" > value="for $i in instance('some-instance')/path/to/selected/item return /itemset/item[. = $i]/@id"/> >Assuming you want to set the value to an element Yes, it's what I want to do. And your sample point me the Xpath mistake I have made. Thanks, Ryan. Marc -- 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 |