repeatable 2 tier select1

View: New views
7 Messages — Rating Filter:   Alert me  

repeatable 2 tier select1

by Park, Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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


Genres

ADD

Authority Genre




--
You receive this message as a subscriber of the ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: repeatable 2 tier select1

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

On Tue, May 6, 2008 at 6:14 AM, Park, Michael <Michael_Park_1@...> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

RE: Re: repeatable 2 tier select1

by Park, Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: avernet@... [mailto:avernet@...] On Behalf Of
Alessandro Vernet
Sent: Wednesday, May 07, 2008 1:23 PM
To: ops-users@...
Subject: [ops-users] Re: repeatable 2 tier select1

Mike,

On Tue, May 6, 2008 at 6:14 AM, Park, Michael <Michael_Park_1@...>
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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Re: RE: Re: repeatable 2 tier select1

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

On Wed, May 7, 2008 at 10:40 AM, Park, Michael <Michael_Park_1@...> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

genres.xhtml (4K) Download Attachment
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

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

by Park, Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Thanks,
Mike

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

Mike,

On Wed, May 7, 2008 at 10:40 AM, Park, Michael
<Michael_Park_1@...> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

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

by Alessandro Vernet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mike,

On Wed, May 7, 2008 at 8:13 PM, Park, Michael <Michael_Park_1@...> 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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.com/

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

by Park, Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the help!  I look forward to it.

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

Mike,

On Wed, May 7, 2008 at 8:13 PM, Park, Michael <Michael_Park_1@...>
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 ops-users@... mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@...
For general help: mailto:sympa@...?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws