fr:box-select actions

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

fr:box-select actions

devo
Hello,

I have asked this on stackoverflow because that is where the orbeon website said to ask questions, but I thought I better post here as well (I will update the stackoverflow one if I get an answer here).

I am trying to get an orbeon xforms form-runner box-select control to work.  Here is my box-select:

    <fr:box-select bind="box-select-bind" id="box-select-control">
            <xforms:action ev:event="xforms-value-changed">
             <xxforms:variable name="selected-value" select="."/>
             <xforms:message level="modal">Hello:<xforms:output select="$selected-value" />
             </xforms:message>

            </xforms:action>

            <xforms:itemset nodeset="instance('codes')/box-select/item">
                                        <xforms:label ref="label"/>
                                        <xforms:value ref="value"/>
             </xforms:itemset>
       </fr:box-select>

The binding is to a simple xml file with a node like so

    <box-results></box-results>

The codes XML looks like so:

    <box-select>
        <item>
            <label>Cat</label>
            <value>cat</value>
        </item>
        <item>
            <label>Dog</label>
            <value>dog</value>
        </item>
        <item>
            <label>Bird</label>
            <value>bird</value>
        </item>
        <item>
            <label>Fish</label>
            <value>fish</value>
        </item>
    </box-select>

When I check entries in the box, my node "box-results" gets updated with the selected values separated by a space, which seems to be what is expected.  However, I can't seem to find any documentation on how to process the selected values.  I want to get access to what value was just selected, de-selected and use the value of this item in an xpath.  So, if a value was selected then I would do this:

    <setvalue
     ref="somexpath[id=$selected-value]/display
     value="'true'"
     />

And if a value was deselected I would do this:
   
    <setvalue
     ref="somexpath[id=$selected-value]/display
     value="'false'"
     />

Basically, I just want to know the event to use, and how to get access to the value when it fires.  Then I want to use this value in an xpath.  I am going to use this to hide/display portions of the form.  Using the xforms-value-changed event the Xpath "." doesn't return what I would expect, as it does in "select1" controls.

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: fr:box-select actions

Erik Bruchez
Administrator
For reference the StackOverflow discussion and answers:
http://stackoverflow.com/questions/7560527/how-to-do-something-with-selected-values-of-an-xformsselect-every-time-they-chan
-Erik
On Mon, Sep 26, 2011 at 1:15 PM, devo <[hidden email]> wrote:

> Hello,
>
> I have asked this on stackoverflow because that is where the orbeon website
> said to ask questions, but I thought I better post here as well (I will
> update the stackoverflow one if I get an answer here).
>
> I am trying to get an orbeon xforms form-runner box-select control to work.
> Here is my box-select:
>
>    <fr:box-select bind="box-select-bind" id="box-select-control">
>            <xforms:action ev:event="xforms-value-changed">
>             <xxforms:variable name="selected-value" select="."/>
>             <xforms:message level="modal">Hello:<xforms:output
> select="$selected-value" />
>             </xforms:message>
>
>            </xforms:action>
>
>            <xforms:itemset nodeset="instance('codes')/box-select/item">
>                                        <xforms:label ref="label"/>
>                                        <xforms:value ref="value"/>
>             </xforms:itemset>
>       </fr:box-select>
>
> The binding is to a simple xml file with a node like so
>
>    <box-results></box-results>
>
> The codes XML looks like so:
>
>    <box-select>
>        <item>
>            <label>Cat</label>
>            <value>cat</value>
>        </item>
>        <item>
>            <label>Dog</label>
>            <value>dog</value>
>        </item>
>        <item>
>            <label>Bird</label>
>            <value>bird</value>
>        </item>
>        <item>
>            <label>Fish</label>
>            <value>fish</value>
>        </item>
>    </box-select>
>
> When I check entries in the box, my node "box-results" gets updated with the
> selected values separated by a space, which seems to be what is expected.
> However, I can't seem to find any documentation on how to process the
> selected values.  I want to get access to what value was just selected,
> de-selected and use the value of this item in an xpath.  So, if a value was
> selected then I would do this:
>
>    <setvalue
>     ref="somexpath[id=$selected-value]/display
>     value="'true'"
>     />
>
> And if a value was deselected I would do this:
>
>    <setvalue
>     ref="somexpath[id=$selected-value]/display
>     value="'false'"
>     />
>
> Basically, I just want to know the event to use, and how to get access to
> the value when it fires.  Then I want to use this value in an xpath.  I am
> going to use this to hide/display portions of the form.  Using the
> xforms-value-changed event the Xpath "." doesn't return what I would expect,
> as it does in "select1" controls.
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/fr-box-select-actions-tp3845202p3845202.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
>
>


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