0

我要求将整数字段的最大长度限制为 10 位。但似乎如果我们将类型绑定到整数,则 maxlength 不适用于输入字段。

<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>

如果我从绑定中删除 type="xs:integer" ,则 maxlength 工作正常。

请给我一个替代方案?

4

1 回答 1

1

这似乎适用于最新的夜间版本,以及以下完整示例:

<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>
于 2011-03-18T19:12:31.107 回答