widget:message

Purpose

Message displayed when particular type of validation error occurs. This element is used by the Simple Validator widget. It should not be specified for a Multiple Forms Validator widget because a server side process is responsible for displaying error messages.

Contained by

Attribute groups

Attribute

Attribute Description Type Default Options Use
type Defines message type xs:string invalid  invalid, empty  optional 

Example

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:widget="http://www.volantis.com/xmlns/2006/05/widget"
  xmlns:xforms="http://www.w3.org/2002/xforms"
  xmlns:si="http://www.volantis.com/xmlns/2006/01/xdime2/si">
  <head>
    <title>widget:validate</title>
    <style type="text/css">
      #name {
        mcs-validation-error-action: message;
        mcs-input-format: 'M:Xxxx*x';
      }
      #pin {
        mcs-validation-error-action: message;
        mcs-input-format: 'N:######';
      }
    </style>
    <xforms:model>
      <xforms:instance>
        <si:instance>
          <si:item name="name"/>
          <si:item name="pin"/>
        </si:instance>
      </xforms:instance>
      <xforms:submission id="submit" action="."/>
    </xforms:model>
  </head>
  <body>
    <p>
      <xforms:input ref="name" id="name">
        <xforms:label>Name</xforms:label>
        <widget:validate message-area="formMessage1">
          <widget:message type="empty">The name cannot be empty! </widget:message>
          <widget:message type="invalid">The name must be at least 4 characters and start with an
            uppercase character!</widget:message>
        </widget:validate>
      </xforms:input>
      <span id="formMessage1"/>
    </p>
    <p>
      <xforms:input ref="pin" id="pin">
        <xforms:label>PIN</xforms:label>
        <widget:validate message-area="formMessage2">
          <widget:message type="empty">PIN cannot be empty!</widget:message>
          <widget:message type="invalid">PIN must consist of 6 digits!</widget:message>
        </widget:validate>
      </xforms:input>
      <span id="formMessage2"/>
    </p>
  </body>
</html>

Related topics