tags:

views:

27

answers:

1

I have a dropdown to display status, which can be Enabled(true) or Disabled(false). Here is my xml instance.

<?xml version="1.0" encoding="UTF-8"?>
    <page>
        <file-name></file-name>
        <status></status>
    </page>

By default, status should be true. So I have set it in binding as follows.

<xforms:bind nodeset="./status" xxforms:default="true()" />

When user chooses Disabled in the dropdown, the status should get saved as false. Here is the xml that gets saved when I save the form.

<page>
    <file-name>StatusDisabled.xml</file-name>
    <status>false</false>
</page>

When I open the form in edit mode, this is the xml I get in the XML inspector widget.

<page>
    <file-name>StatusDisabled.xml</file-name>
    <status>true></status>
</page>

Status gets set to true because of xxforms:default, even though the xml is saved with a false value for status.

How can I fix this?

Here is the xhtml:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"&gt;

    <head>
        <title>XForms Default</title>

        <xforms:model>
            <xforms:instance id="instance">
                <page>
                    <name xmlns=""/>    
                    <status xmlns=""/>
                </page>
            </xforms:instance>

            <xforms:instance id="status-instance">
                <items>
                    <item label="Enabled" value="true" xmlns=""/>
                    <item label="Disabled" value="false" xmlns=""/>
                </items>
            </xforms:instance>

            <xforms:bind nodeset="instance('instance')">
                <xforms:bind nodeset="./status" xxforms:default="true()" />
            </xforms:bind>

        </xforms:model>
    </head>
    <body>
        <p>
            <xforms:input ref="instance('instance')/name" incremental="true">
                <xforms:label>Please enter your name:</xforms:label>
            </xforms:input>
        </p>
        <p>
            <xforms:select1 ref="instance('instance')/status" appearance="minimal" incremental="true">
                <xforms:label>Please select status:</xforms:label>
                <xforms:itemset nodeset="instance('status-instance')/item">
                    <xforms:label ref="./@label"/>
                    <xforms:value ref="./@value"/>
                </xforms:itemset>
            </xforms:select1> 
        </p>
    </body>
</html>
A: 

If this happens, it's a bug. xxforms:default should only be evaluated once.

ebruchez
@ebruchez - I have edited my question with step-by-step examples. It looks like a bug to me. Could you please help me fix this?
Purni