Question

Error summary control is reporting a wrong invalid field count. Attached is the source. Steps to reproduce.

  1. When you first access the page you will have two empty fields and the invalid count is 2.
  2. Add "Apple" to the first text box
  3. Tab into the second input control (do not enter anything).
  4. Click on delete button.

Nodeset has a single Orange node which has a valid value and yet error summary reports that it has one invalid field.

`

<xhtml:head>
    <xhtml:title>Repeat Groups</xhtml:title>
    <xforms:model>
        <xforms:instance id="instance">
            <fruits>
                <orange></orange>
                <orange></orange>
                <invalid>0</invalid>
            </fruits>
        </xforms:instance>
        <xforms:instance id="origin-instance">
            <orange></orange>
        </xforms:instance>
    <xforms:bind nodeset="orange" required="true()" />
    </xforms:model>
</xhtml:head>
<xhtml:body>

    <xhtml:h2>Errors</xhtml:h2>
    <fr:error-summary observer="accordionSection" errors-count-ref="invalid" />

    <xforms:group>
         <xforms:output value="invalid">
          <xforms:label>Invalid field count: </xforms:label>
         </xforms:output>
    </xforms:group>

    <xforms:group id="accordionSection">
        <xhtml:h2>With labels</xhtml:h2>
        <xforms:repeat nodeset="orange" id="fruit-repeat-1">
                <xforms:input ref=".">
                <xforms:alert>Fruit: </xforms:alert>
                <xforms:label>Fruit: </xforms:label>
        </xforms:input>
        <xhtml:br />
        </xforms:repeat>
    </xforms:group>

    <xhtml:br/>

    <xforms:trigger>
        <xforms:label>Add</xforms:label>
        <xforms:insert ev:event="DOMActivate" nodeset="orange" at="index('fruit-repeat-1')" origin="instance('origin-instance')"/>
    </xforms:trigger>
    <xforms:trigger>
        <xforms:label>Remove</xforms:label>
        <xforms:delete ev:event="DOMActivate" nodeset="orange" at="index('fruit-repeat-1')"/>
    </xforms:trigger>
</xhtml:body>

`

Was it helpful?

Solution

Your example works fine with a nightly build, so this might be due to a bug that has been fixed since the version you are using. Could you try with a nightly build and let us know if this works for you?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top