errorCondition Element

Microsoft Office InfoPath

Show All Show All

errorCondition Element

Defines a custom validation (or error condition) for a specific XML Document Object Model (DOM) node in a form's underlying XML document.

Type

      xsd:complexType
    

Structure

Name Description
expression (Required attribute) An XPath expression (relative to the expressionContext attribute, if specified) that must be evaluated to validate the XML DOM node specified in the match attribute.
expressionContext (Optional attribute) Specifies the XML DOM node on which the expression specified in the expression attribute is rooted.
match(Required attribute) Identifies the XML DOM nodes on which the custom validation is declared.
showErrorOn (Optional attribute) Identifies XML DOM nodes (within the context of the expression context XML DOM node) on which the error should be displayed when the form is filled out.
errorMessage(Required element) Specifies the error message to be returned if the value of the specified XML DOM node is considered to be invalid.

Remarks

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

Example

The following is an example of the errorCondition 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>