mcs:pattern

Purpose

Defines a pattern to be used for validation; equivalent to the HTML 5 pattern attribute.

Contained by

Attributes

Attribute Description Type Default Options Use
value The regular expression (in the sense of the ECMAScript specification) that defines the validation pattern. xs:anySimpleType   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"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>mcs:pattern</title>
    <xforms:model id="login">
      <xsd:schema>
        <xsd:simpleType name="myType">
          <xsd:restriction base="xforms:string">
            <mcs:pattern value=".*cat.*"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:schema>
      <xforms:instance>
        <si:instance>
          <si:item name="firstName"/>
        </si:instance>
      </xforms:instance>
      <xforms:bind nodeset="firstName" type="myType"/>
    </xforms:model>
  </head>
  <body>
    <xforms:input model="login" ref="firstName">
      <xforms:label>Your Name:</xforms:label>
    </xforms:input>
  </body>
</html>

Related topics