xsd:maxLength

Purpose

Specifies an inclusive maximum length of an input field; equivalent to the HTML 5 maxlength attribute.

Contained by

Attributes

Attribute Description Type Default Options Use
value The maximum number of characters allowed in the input form field. xs:nonNegativeInteger   required 

Example

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:si="http://www.volantis.com/xmlns/2006/01/xdime2/si"
  xmlns:xforms="http://www.w3.org/2002/xforms"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <head>
    <title>xsd:maxLength</title>
    <xforms:model id="model1">
      <xsd:schema>
        <xsd:simpleType name="myType" >
          <xsd:restriction base="xforms:string">
            <xsd:maxLength value="16"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:schema>
      <xforms:instance>
        <si:instance>
          <si:item name="password"/>
        </si:instance>
      </xforms:instance>
      <xforms:bind nodeset="password" type="myType"/>
    </xforms:model>
  </head>
  <body>
    <xforms:input model="model1" ref="password">
      <xforms:label>Password:</xforms:label>
    </xforms:input>
  </body>
</html>

Related topics