repeatable 2 tier select1

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

repeatable 2 tier select1

Park, Michael

Hello,

 

Has anyone successfully created a select1 that triggers a second select1, which is repeatable?

 

I cannot get the behavior correct with 2 select1s once I add it to a repeat element.  I think I am close though.

 

Any help would be appreciated.  I’ve attached the code and inserted the repeat section.

 

<xforms:repeat nodeset="instance('genres')/info" id="repeat">

  <xforms:select1 ref="@authority">

    <xforms:label>Authority </xforms:label>

    <xforms:itemset nodeset="instance('choices')/authority">

      <xforms:label ref="@label" />

      <xforms:value ref="@value" />

    </xforms:itemset>

  </xforms:select1>

                       

  <xforms:select1 ref="@genre">

    <xforms:label>Genre </xforms:label>

    <xforms:itemset nodeset="for $pos in position() return instance('genre-select')/genre[@auth = instance('genres')/info[$pos]/@authority]">

      <xforms:label ref="@label" />

      <xforms:value ref="@value" />

    </xforms:itemset>

  </xforms:select1>

</xforms:repeat>

 

Thanks,

Mike



--
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

genres.html (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: repeatable 2 tier select1

Alessandro Vernet
Administrator
Mike,

On Tue, May 6, 2008 at 6:14 AM, Park, Michael <[hidden email]> wrote:
>     <xforms:itemset nodeset="for $pos in position() return
> instance('genre-select')/genre[@auth =
> instance('genres')/info[$pos]/@authority]">

This should work, but there might be a problem with the above XPath
expression. The context of the "noteset" expression is the node bound
to the select1. So position() will return 1 in this case, and not the
position in the repeat. In this case, the xxforms:index('repeat-id')
extension function should do the trick.

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
Reply | Threaded
Open this post in threaded view
|

RE: Re: repeatable 2 tier select1

Park, Michael
Alex,

Thanks.  Maybe I'm missing something else then. I swapped out the
following as you recommended. The second select1 list for all nodes
changes to whatever index you are currently at:

nodeset="for $pos in index('repeat') return
instance('genre-select')/genre[@auth =
instance('genres')/info[$pos]/@authority]"

for

nodeset="instance('genre-select')/genre[@auth =
instance('genres')/info[xxforms:index('repeat')]/@authority]"


-Mike

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Wednesday, May 07, 2008 1:23 PM
To: [hidden email]
Subject: [ops-users] Re: repeatable 2 tier select1

Mike,

On Tue, May 6, 2008 at 6:14 AM, Park, Michael <[hidden email]>
wrote:
>     <xforms:itemset nodeset="for $pos in position() return
> instance('genre-select')/genre[@auth =
> instance('genres')/info[$pos]/@authority]">

This should work, but there might be a problem with the above XPath
expression. The context of the "noteset" expression is the node bound
to the select1. So position() will return 1 in this case, and not the
position in the repeat. In this case, the xxforms:index('repeat-id')
extension function should do the trick.

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
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: repeatable 2 tier select1

Alessandro Vernet
Administrator
Mike,

On Wed, May 7, 2008 at 10:40 AM, Park, Michael <[hidden email]> wrote:

>  Thanks.  Maybe I'm missing something else then. I swapped out the
>  following as you recommended. The second select1 list for all nodes
>  changes to whatever index you are currently at:
>
>  nodeset="for $pos in index('repeat') return
>
> instance('genre-select')/genre[@auth =
>  instance('genres')/info[$pos]/@authority]"
>
>  for
>
>  nodeset="instance('genre-select')/genre[@auth =
>  instance('genres')/info[xxforms:index('repeat')]/@authority]"
My apologies! xxforms:index('some-repeat-id') returns the current
index for the repeat you specify, which is not what we want here. We
don't want to know what the current select row is in the UI, but what
the current position is. So you were right to use position(), but it
was just not working because of the context change. What you can do
here is to declare a variable right after the <xforms:repeat> that
contains the current position, and use it later in your nodeset
expression. I have updated your example with this; you'll find it
attached.

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

genres.xhtml (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Re: repeatable 2 tier select1

Park, Michael
So this requires version 3.7 in order to use xxforms:variable?

Thanks,
Mike

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Wednesday, May 07, 2008 9:28 PM
To: [hidden email]
Subject: [ops-users] Re: RE: Re: repeatable 2 tier select1

Mike,

On Wed, May 7, 2008 at 10:40 AM, Park, Michael
<[hidden email]> wrote:

>  Thanks.  Maybe I'm missing something else then. I swapped out the
>  following as you recommended. The second select1 list for all nodes
>  changes to whatever index you are currently at:
>
>  nodeset="for $pos in index('repeat') return
>
> instance('genre-select')/genre[@auth =
>  instance('genres')/info[$pos]/@authority]"
>
>  for
>
>  nodeset="instance('genre-select')/genre[@auth =
>  instance('genres')/info[xxforms:index('repeat')]/@authority]"
My apologies! xxforms:index('some-repeat-id') returns the current
index for the repeat you specify, which is not what we want here. We
don't want to know what the current select row is in the UI, but what
the current position is. So you were right to use position(), but it
was just not working because of the context change. What you can do
here is to declare a variable right after the <xforms:repeat> that
contains the current position, and use it later in your nodeset
expression. I have updated your example with this; you'll find it
attached.

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
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: RE: Re: repeatable 2 tier select1

Alessandro Vernet
Administrator
Mike,

On Wed, May 7, 2008 at 8:13 PM, Park, Michael <[hidden email]> wrote:
> So this requires version 3.7 in order to use xxforms:variable?

Yes, exactly, you will need a nightly build for this (which is very
close to the upcoming 3.7).

http://forge.objectweb.org/nightlybuilds/ops/ops/

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
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Re: RE: Re: repeatable 2 tier select1

Park, Michael
Thanks for the help!  I look forward to it.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Thursday, May 08, 2008 1:30 PM
To: [hidden email]
Subject: [ops-users] Re: RE: Re: RE: Re: repeatable 2 tier select1

Mike,

On Wed, May 7, 2008 at 8:13 PM, Park, Michael <[hidden email]>
wrote:
> So this requires version 3.7 in order to use xxforms:variable?

Yes, exactly, you will need a nightly build for this (which is very
close to the upcoming 3.7).

http://forge.objectweb.org/nightlybuilds/ops/ops/

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