Question

I have a requirement to limit the maxlength of an integer field to 10 digits. But it seems like if we bind the type to integer, the maxlength is not working for input field.

<xforms:bind id="int-field" nodeset="instance('prepop')/type/int-field" type="xs:integer"/>

<xforms:input bind="int-field" xxforms:maxlength="10">
<xforms:alert>Required</xforms:alert>
</xforms:input>

And if I remove that type="xs:integer" from the bind, the maxlength works fine.

Please suggest me an alternative?

Was it helpful?

Solution

This seems to be working fine with the latest nightly build, and the following full example:

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
    <xhtml:head>
        <xhtml:title>Input bound to integer node with maxlength attribute</xhtml:title>
        <xforms:model>
            <xforms:instance>
                <instance>123</instance>
            </xforms:instance>
            <xforms:bind nodeset="." type="xs:integer"/>
        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <xforms:input ref="." xxforms:maxlength="10">
            <xforms:alert>Required</xforms:alert>
        </xforms:input>
    </xhtml:body>
</xhtml:html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top