itemset Question

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

itemset Question

devo
Hello,

I am using an itemset within a select1 element like so:

<xforms:select1 ref="xxforms:evaluate($bind)" appearance="full">
    <xforms:itemset nodeset="instance('my-instance')/RoleType/entry">
        <xxforms:variable name="case" select="@id" />
        <xforms:label ref="name"/>
        <xforms:value ref="value"/>
       
    </xforms:itemset> 

 <xforms:action ev:event="xforms-value-changed">
                       
        <xforms:toggle case="$case"/>
    </xforms:action>

</xforms:select1>

I want to fire a toggle event and I want the case of the toggle to be dynamically based off the item in the itemset.  However, I can't seem to see any examples of of how to do this.  How can I write an Xpath that knows which radio button this is firing on.

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

Re: itemset Question

fl.schmitt(ops-users)
devo wrote
I want to fire a toggle event and I want the case of the toggle to be dynamically based off the item in the itemset.  However, I can't seem to see any examples of of how to do this.  How can I write an Xpath that knows which radio button this is firing on.
hmm - i'm not sure if this fits your needs, but since the selected item is represented in the referenced node, it may be a solution to simply check the new value on xforms-value-changed, and toggle according to that value?

florian
Reply | Threaded
Open this post in threaded view
|

Re: itemset Question

Alessandro  Vernet
Administrator
In reply to this post by devo
If think that what you are looking for is is solved by an AVT. E.g.:

<xforms:toggle case="{$case}"/>

For more on AVTs, see:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-attribute-value-templates

Alex

On Mon, May 17, 2010 at 12:32 PM, devo <[hidden email]> wrote:

>
> Hello,
>
> I am using an itemset within a select1 element like so:
>
> <xforms:select1 ref="xxforms:evaluate($bind)" appearance="full">
>    <xforms:itemset nodeset="instance('my-instance')/RoleType/entry">
>        <xxforms:variable name="case" select="@id" />
>        <xforms:label ref="name"/>
>        <xforms:value ref="value"/>
>
>    </xforms:itemset>
>
>  <xforms:action ev:event="xforms-value-changed">
>                       <!-- case in the togggle needs to be based off the id
> attribute
>                       of the item in the itemset -->
>        <xforms:toggle case="$case"/>
>    </xforms:action>
>
> </xforms:select1>
>
> I want to fire a toggle event and I want the case of the toggle to be
> dynamically based off the item in the itemset.  However, I can't seem to see
> any examples of of how to do this.  How can I write an Xpath that knows
> which radio button this is firing on.
>
> Thanks.
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/itemset-Question-tp2220233p2220233.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: itemset Question

devo

Alessandro Vernet wrote
If think that what you are looking for is is solved by an AVT. E.g.:

<xforms:toggle case="{$case}"/>

For more on AVTs, see:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-attribute-value-templates

Alex
Thanks Alex, that is interesting, I didn't realize you could do that. However, I am curious as to what florian said:

fl.schmitt(ops-users) wrote
hmm - i'm not sure if this fits your needs, but since the selected item is represented in the referenced node, it may be a solution to simply check the new value on xforms-value-changed, and toggle according to that value?

florian
This is what I wanted to do but I don't know how to reference the value in the xforms-value-changed event.  I don't know what the syntax is to reference the currently selected item.

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: Re: itemset Question

Alessandro  Vernet
Administrator
You can't have access to a variable declared inside the
<xforms:itemset> outside of the <xforms:itemset>. But assuming that
there is only one 'entry' with the selected value, you could write:

<xforms:select1 ref="xxforms:evaluate($bind)" appearance="full">
    <xforms:itemset nodeset="instance('my-instance')/RoleType/entry">
        <xforms:label ref="name"/>
        <xforms:value ref="value"/>
    </xforms:itemset>
    <xforms:action ev:event="xforms-value-changed">
        <!-- case in the toggle needs to be based off the id attribute
of the item in the itemset -->
        <xxforms:variable name="selected-value" select="."/>
        <xforms:toggle
case="{instance('my-instance')/RoleType/entry[value =
$selected-value]/@id}"/>
    </xforms:action>
</xforms:select1>

Alex

On Wed, May 19, 2010 at 7:30 AM, devo <[hidden email]> wrote:

>
>
>
> Alessandro  Vernet wrote:
>>
>> If think that what you are looking for is is solved by an AVT. E.g.:
>>
>> <xforms:toggle case="{$case}"/>
>>
>> For more on AVTs, see:
>>
>> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-attribute-value-templates
>>
>> Alex
>>
>>
>
> Thanks Alex, that is interesting, I didn't realize you could do that.
> However, I am curious as to what florian said:
>
>
> fl.schmitt(ops-users) wrote:
>>
>> hmm - i'm not sure if this fits your needs, but since the selected item is
>> represented in the referenced node, it may be a solution to simply check
>> the new value on xforms-value-changed, and toggle according to that value?
>>
>> florian
>>
>>
>
> This is what I wanted to do but I don't know how to reference the value in
> the xforms-value-changed event.  I don't know what the syntax is to
> reference the currently selected item.
>
> Thanks.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/itemset-Question-tp2220233p2222932.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: itemset Question

devo
Alessandro Vernet wrote
<xforms:select1 ref="xxforms:evaluate($bind)" appearance="full">
    <xforms:itemset nodeset="instance('my-instance')/RoleType/entry">
        <xforms:label ref="name"/>
        <xforms:value ref="value"/>
    </xforms:itemset>
    <xforms:action ev:event="xforms-value-changed">
       
        <xxforms:variable name="selected-value" select="."/>
        <xforms:toggle
case="{instance('my-instance')/RoleType/entry[value =
$selected-value]/@id}"/>
    </xforms:action>
</xforms:select1>
Thanks Alex.  This is exactly what I needed.  I couldn't find any documentation on how to reference that in the event for the item set.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: itemset Question

Alessandro  Vernet
Administrator
I am glad it works for you. And certainly feel free to fire your
questions here if you can't find something in the documentation, or
observe some unexpected behavior; this is also useful for the
community.

Alex

On Tue, May 25, 2010 at 6:30 AM, devo <[hidden email]> wrote:

>
>
> Alessandro  Vernet wrote:
>>
>> <xforms:select1 ref="xxforms:evaluate($bind)" appearance="full">
>>     <xforms:itemset nodeset="instance('my-instance')/RoleType/entry">
>>         <xforms:label ref="name"/>
>>         <xforms:value ref="value"/>
>>     </xforms:itemset>
>>     <xforms:action ev:event="xforms-value-changed">
>>         <!-- case in the toggle needs to be based off the id attribute
>> of the item in the itemset -->
>>         <xxforms:variable name="selected-value" select="."/>
>>         <xforms:toggle
>> case="{instance('my-instance')/RoleType/entry[value =
>> $selected-value]/@id}"/>
>>     </xforms:action>
>> </xforms:select1>
>>
>>
>
> Thanks Alex.  This is exactly what I needed.  I couldn't find any
> documentation on how to reference that in the event for the item set.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/itemset-Question-tp2220233p2230003.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My 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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet