expression Attribute

Microsoft Office InfoPath

Show All Show All

expression Attribute

An XPath expression (relative to the expressionContext attribute, if specified) that must be evaluated to validate the XML Document Object Model (DOM) node specified in the match attribute.

Type

      xsd:string
    

Remarks

The expression attribute is a required attribute of the errorCondition element.

If the specified expression evaluates to True, it is considered to be an error condition and the specified error message is displayed.

Example

The following is an example of the expression attribute as it is used in 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>