XForms: set default selection in dropdown in binding

Posted by Purni on Stack Overflow See other posts from Stack Overflow or by Purni
Published on 2010-06-10T22:29:13Z Indexed on 2010/06/10 22:32 UTC
Read the original article Hit count: 203

Filed under:

I have a main instance named 'myinstance' which has the element . Color can be 'Red', 'Blue', 'Green' or ''Yellow'. The colors are populated in a drop-down from another instance called 'colorsinstance'. When my form loads, I want the default in the dropdown to be set to 'Green' in the nodeset binding.

<instance id="colorsinstance">  
    <items>
        <item label="Color1" value="Red"/>
        <item label="Color2" value="Blue"/>
        <item label="Color3" value="Green"/>
        <item label="Color4" value="Yellow"/>
    </items>
</instance>

Main instance binding is as follows:

<xforms:bind nodeset="instance('myinstance')">
    <xforms:bind nodeset="./color" required="true()"/>
</xforms:bind>

© Stack Overflow or respective owner

Related posts about xforms