How to output the label of a selected combo box

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

How to output the label of a selected combo box

Joseph Lawrence
Erik,
       I have the following requirement:
 
<xforms:model>
            <xforms:instance id=”main”>
                        <main>
                                    <employee>
                                                <name>Tomie</name>
                                                <id>101</id>
                                    </employee>
                                    <employee>
                                                <name>Suzaine</name>
                                                <id>201</id>
                                    </employee>
                                    <employee>
                                                <name>Bruce</name>
                                                <id>301</id>
                                    </employee>
                        </main>
            </xforms:instance>
<xforms:instance id=”for-display”>
<for-display>
            <value/>
</for-display>
</xforms:instance>
</xforms:model>
……….
……….
<xhtml:body>
            <xforms:select1 ref=”instance(‘for-display’)/value” appearance=”minimal”>
                        <xforms:itemset nodeset=” instance(‘main’)/employee”>
                                    <xforms:label ref=”./name”/>
                                    <xforms:value ref=”./id”/>
                        </xforms:itemset>
            </xforms:select1>
            <xforms:output ref=” instance(‘for-display’)/value”/><!—Using this I can display the value of id-->
</xhtml:body>
 
Now my query is, will it be possible that I can output the name of the selected employee
 
Thanks
Joseph Lawrence
Stabilix Solutions Pvt Ltd


Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail Beta.

--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: How to output the label of a selected combo box

Adrian Baker-2
Joseph,

How about:

<xforms:output ref="instance('main')/employee[id = instance('for-display')/value]/name"/>

For a little more flexibility you could use the 'value' attribute of <xforms:output> instead, which would easily let you output a custom message when no employee is selected, for example.

Adrian

joseph lawrence wrote:
Erik,
       I have the following requirement:
 
<xforms:model>
            <xforms:instance id=”main”>
                        <main>
                                    <employee>
                                                <name>Tomie</name>
                                                <id>101</id>
                                    </employee>
                                    <employee>
                                                <name>Suzaine</name>
                                                <id>201</id>
                                    </employee>
                                    <employee>
                                                <name>Bruce</name>
                                                <id>301</id>
                                    </employee>
                        </main>
            </xforms:instance>
<xforms:instance id=”for-display”>
<for-display>
            <value/>
</for-display>
</xforms:instance>
</xforms:model>
……….
……….
<xhtml:body>
            <xforms:select1 ref=”instance(‘for-display’)/value” appearance=”minimal”>
                        <xforms:itemset nodeset=” instance(‘main’)/employee”>
                                    <xforms:label ref=”./name”/>
                                    <xforms:value ref=”./id”/>
                        </xforms:itemset>
            </xforms:select1>
            <xforms:output ref=” instance(‘for-display’)/value”/><!—Using this I can display the value of id-->
</xhtml:body>
 
Now my query is, will it be possible that I can output the name of the selected employee
 
Thanks
Joseph Lawrence
Stabilix Solutions Pvt Ltd


Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail Beta.

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws