Show All

# customValidation Element

Defines rule-based custom validation on top of all validation enforced through the XML Schema.

## Type

    xsd:complexType

## Structure

Name | Description
--- | ---
errorCondition | (Optional element) Defines a custom validation (or error condition) for a specific XML Document Object Model (DOM) node in a form's underlying XML document.

## Remarks

The customValidation element is an optional element of the xDocumentClass element.

Note It is possible to create multiple error conditions on a field in a form using multiple errorCondition elements, but they will not appear in the Data Validation dialog box while in design mode.

## Example

The following is an example of the customValidation element:

    <xsf:customValidation>
       <xsf:errorCondition
          match="/exp:expenseReport"
          expressionContext="exp:reportDate"
          expression="msxsl:string-compare(., ../exp:startDate) < 0 and ../exp:startDate != """
          showErrorOn=".">
          <xsf:errorMessage
             type="modeless"
             shortMessage="The report date occurs before the end of the expense period.">
             The report date occurs before the end of the expense period. Verify that this is correct.
          </xsf:errorMessage>
       </xsf:errorCondition>
    </xsf:customValidation>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp