The xsf:errorCondition Element

 <  Day Day Up  >  

The <xsf:errorCondition> Element

When you add validation rules using the InfoPath 2003 client in design mode, then a corresponding number of xsf:errorCondition elements are added to the manifest file. The xsf:errorCondition element defines a potential error condition on a specific node in the DOM tree.

The attributes of the xsf:errorCondition element are as follows :

  • expression ” A required attribute that specifies the XPath expression that must be used to validate the value of the DOM node. Commonly, the XPath expression will make use of proprietary Microsoft extension functions.

  • expressionContext ” An optional attribute that can be used to specify the XPath context relative to which the XPath expression in the expression attribute is evaluated.

  • match ” A required attribute that specifies the node in the DOM tree to which the error condition is applicable .

  • showErrorOn ” An optional attribute that specifies a node on which the error message should be displayed. Often this will be the DOM node specified using the match attribute, so the default value of the showErrorOn attribute is the period (the abbreviation for the XPath expression self::node() ).

The xsf:errorCondition element has a required child element, the xsf:errorMessage element, which is described in the next section.

The <xsf:errorMessage> Element

The xsf:errorMessage element specifies the message that is to be displayed if the DOM node specified in the match attribute of its parent xsf:errorCondition element is considered to be invalid. The message is the text contained between the start and end tags of the xsf:errorMessage element.

In addition, the xsf:errorMessage element has a required shortMessage attribute whose value specifies a short message to be displayed in the event of the DOM node being considered invalid. There is also an optional type attribute that specifies the type of error message to return. The permitted values are modal and modeless . A modal message would typically be presented in a dialog box that the user must respond to before proceeding.

The following code illustrates a possible structure of elements inside an xsf:customValidation element:

 <xsf:customValidation>  <xsf:errorCondition   match="my:expenseReport"   expressionContext="my:reportDate"   expression="msxsl:string-compare(., ../my:startDate) < 0 and ../my: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. This is not permitted.   </xsf:errorMessage>  </xsf:errorCondition> </xsf:customValidation> 
 <  Day Day Up  >  


Microsoft Office InfoPath 2003 Kick Start
Microsoft Office InfoPath 2003 Kick Start
ISBN: 067232623X
EAN: 2147483647
Year: 2004
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net