Share via


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.

Bb265025.vs_note(en-us,office.12).gif  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>