Using ORBEON.xforms.Document.getValue in a xf:repeat set

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

Using ORBEON.xforms.Document.getValue in a xf:repeat set

Alex Bleasdale
Hi,

I'm hoping someone can help.  I've been using the getValue method to get values from specific elements by targeting their id's and so far this has worked well.

ORBEON.xforms.Document.getValue("nameOfId");

I'm now in a situation where I'd like to be able to use getValue while I'm in a repeatset and I'm wondering whether anyone can offer me any advice as to how I can do this.

I'm hoping maybe someone can advise whether it's possible to get the value from an element inside the selected index in a repeat set or better, to get the value from a trigger which is inside a repeating item.

In other words:

<xf:repeat id="theRepeatSet" nodeset="aNodeSet">
   <xf:input ref="."><xf:label>aLabel</xf:label></xf:input>
   
   <xf:trigger and xf:action here...>
   <xf:delete nodeset="../*[position()!=1]" at="1" ev:event="DOMActivate"/>
   < ... >

</xf:repeat>

The delete nodeset XPath will target the specified nodeset and delete it (if it's not the first and only nodeset), but I'd like to call a function first like so:

<xxforms:script ev:event="DOMActivate">setConfirmation('param');</xxforms:script>

And in that function I'd like to be able to get the value of the xf:input element at the point from which it was called (the nodeset at="1" - if that makes sense).  Is there currently a way to do this within Orbeon's API?

Thanks very much,
A
Reply | Threaded
Open this post in threaded view
|

Re: Using ORBEON.xforms.Document.getValue in a xf:repeat set

Alex Bleasdale
Just to clarify from the last message, all I really wanted to know was whether there was any way to use either ORBEON.xforms.Document.getValue or similar javascript code to get the value of an element at the selected index of a repeatset.  Has anyone managed to do this?  If so, could they offer any advice?  

Thanks again.
Reply | Threaded
Open this post in threaded view
|

Re: Using ORBEON.xforms.Document.getValue in a xf:repeat set

Alessandro Vernet
Administrator
In reply to this post by Alex Bleasdale
Alex,

On Sun, Apr 20, 2008 at 9:31 AM, Alex Bleasdale <[hidden email]> wrote:
>  <xf:repeat id="theRepeatSet" nodeset="aNodeSet">
>    <xf:input ref="."><xf:label>aLabel</xf:label></xf:input>
>
>    <xf:trigger and xf:action here...>
>    <xf:delete nodeset="../*[position()!=1]" at="1" ev:event="DOMActivate"/>
>    < ... >
>
>  </xf:repeat>

Right now there is no JavaScript API to get the value of a control in
a repeat. However, you can use the fact that the ID of controls in a
repeat look like ID.1, where "ID" is the initial ID you had in XForms,
"." is a special character that looks like a dot, and "1" is the
iteration you are interested in. There is a JavaScript variable that
points to this special character: XFORMS_SEPARATOR_1. So in you code
you would use ORBEON.xforms.Document.getValue("myid" +
XFORMS_SEPARATOR_1 + "21").

The case of nested repeats is a little more complicated, but you seem
to have a repeat with one level here.

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