Unable to hide options of select/select1

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

Unable to hide options of select/select1

bsmets
I seem to have some problems hiding options of a select / select1. Please look at the example below. Regardless of the value of value2, both options of the first select remain visible. This happens with both select and select1. It looks liks the xf:group elements are just ignored.

<html xmlns:xf="http://www.w3.org/2002/xforms" xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <title>Test</title>
                <xf:model id="model">
                        <xf:instance id="default-instance">
                                <values xmlns="">
                                        <value1>something</value1>
                                        <value2>foo</value2>
                                </values>
                        </xf:instance>
                </xf:model>
        </head>
        <body>
                <xf:select ref="value1" appearance="full">
                        <xf:group ref=".[../value2 = 'foo']">
                                <xf:item>
                                        <xf:label>something</xf:label>
                                        <xf:value>something</xf:value>
                                </xf:item>
                        </xf:group>
                        <xf:group ref=".[../value2 = 'foo']">
                                <xf:item>
                                        <xf:label>some other thing</xf:label>
                                        <xf:value>someotherthing</xf:value>
                                </xf:item>
                        </xf:group>
                </xf:select>
                <xf:select1 ref="value2" appearance="full">
                        <xf:item>
                                <xf:label>foo</xf:label>
                                <xf:value>foo</xf:value>
                        </xf:item>
                        <xf:item>
                                <xf:label>bar</xf:label>
                                <xf:value>bar</xf:value>
                        </xf:item>
                </xf:select1>               
        </body>
</html>
   
Reply | Threaded
Open this post in threaded view
|

Re: Unable to hide options of select/select1

Alessandro  Vernet
Administrator
Hi Bart,

You cannot nest an xf:group inside an xf:select, but you can put that expression directly on an itemset, as in the example below. This gives:



<html xmlns:xf="http://www.w3.org/2002/xforms" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Test</title>
        <xf:model id="model">
            <xf:instance id="default-instance">
                <values xmlns="">
                    <relevant/>
                    <value1>something</value1>
                    <value2>foo</value2>
                </values>
            </xf:instance>
            <xf:bind ref="relevant" relevant="false()"/>
        </xf:model>
    </head>
    <body>
        <xf:input ref="relevant"/>
        <xf:select ref="value1" appearance="full">
            <xf:itemset ref=".[../value2 = 'foo']">
                <xf:label>something2</xf:label>
                <xf:value>something</xf:value>
            </xf:itemset>
            <xf:itemset ref=".[../value2 = 'foo']">
                <xf:label>some other thing</xf:label>
                <xf:value>someotherthing</xf:value>
            </xf:itemset>
        </xf:select>
        <xf:select1 ref="value2" appearance="full">
            <xf:item>
                <xf:label>foo</xf:label>
                <xf:value>foo</xf:value>
            </xf:item>
            <xf:item>
                <xf:label>bar</xf:label>
                <xf:value>bar</xf:value>
            </xf:item>
        </xf:select1>
    </body>
</html>

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet