1 2 3 4 5 6 7 8 9 10 11 12
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01021243"><META NAME="lcid" CONTENT="1033"><title>Error Object</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Error Object</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="properties" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="methods" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="events" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><table class="ofvbaomart"><tr><td class="noborder" nowrap="true"><A HREF="xdcolErrors.htm" title="Errors"><SPAN tabindex="0" class="omyellow" id="ParentObject">Errors</SPAN></A><BR /><IMG SRC="../img/parchild.gif" BORDER="0"></IMG><A HREF="xdobjError.htm" title="Error"><SPAN class="omblue">Error</SPAN></A><br /></td></tr></table><p>Represents an error in a Microsoft Office InfoPath 2003 form. Each <b class="bterm">Error</b> object in InfoPath is each associated with an XML <a href="#" class="glossary" onclick="AppendPopup(this,'ofdocumentobjectmodeldom')" onkeypress="AppendPopup(this,'ofdocumentobjectmodeldom')">Document Object Model (DOM)</a> node from a form's underlying XML document. When <a href="#" class="glossary" onclick="AppendPopup(this,'xddatavalidation')" onkeypress="AppendPopup(this,'xddatavalidation')">data validation</a> fails for a particular XML DOM node, InfoPath creates an <b class="bterm">Error</b> object and places it in the <b class="bterm"><a href="xdcolErrors.htm" id="HV01021186" lcid=" ">Errors</a></b> collection. </p><h2>Remarks</h2><p>That are three types of data validation errors that can occur in an InfoPath form:<ul><li><b class="runinhead">SCHEMA_VALIDATION</b> Data validation failed as a result of an <a href="#" class="glossary" onclick="AppendPopup(this,'OfXmlSchemas')" onkeypress="AppendPopup(this,'OfXmlSchemas')">XML Schema</a>–defined constraint.</li><li><b class="runinhead">SYSTEM_GENERATED</b> Data validation failed as a result of constraints defined in the <a href="#" class="glossary" onclick="AppendPopup(this,'xdformdefinitionfilexsf')" onkeypress="AppendPopup(this,'xdformdefinitionfilexsf')">form definition (.xsf) file</a> or as a result of scripting code calling the <b class="bterm"><a href="xdmthReportError.htm" id="HV01021405" lcid=" ">ReportError</a></b> method of the <b class="bterm"><a href="xdobjDataDOMEvent.htm" id="HV01021239" lcid=" ">DataDOMEvent</a></b> object.</li><li><b class="runinhead">USER_SPECIFIED</b> Data validation failed as a result of a custom scripting error using the <b class="bterm"><a href="xdmthAdd.htm" id="HV01021375" lcid=" ">Add</a></b> method of the <b class="bterm">Errors</b> collection.</li></ul><p><b>Note</b> The <b class="bterm"><a href="xdproType_3.htm" id="HV01021346" lcid=" ">Type</a></b> property of the <b class="bterm">Error</b> object can be used to determine the type of data validation error that has occurred.</p></p><h2>Using the Error Object</h2><p>The <b class="bterm">Error</b> object provides a number of properties that can be used to programmatically interact with an InfoPath data validation error. The <b class="bterm">Error</b> object is accessed through the <b class="bterm"><a href="xdproErrors.htm" id="HV01021283" lcid=" ">Errors</a></b> property of the <b class="bterm"><a href="xdobjXDocument.htm" id="HV01021254" lcid=" ">XDocument</a></b> object, which returns a reference to the <b class="bterm">Errors</b> collection.</p><p>In the following example, the <b class="bterm"><a href="xdproItem_3.htm" id="HV01021296" lcid=" ">Item</a></b> property of the <b class="bterm">Errors</b> collection is used to set a reference to an <b class="bterm">Error</b> object; then the <b class="bterm"><a href="xdproShortErrorMessage.htm" id="HV01021331" lcid=" ">ShortErrorMessage</a></b> property of the <b class="bterm">Error</b> object is is used to display the error message in a message box:</p><pre><code>var objError;
objError = XDocument.Errors(0);
XDocument.UI.Alert("Error message: " + objError.ShortErrorMessage);</code></pre><p>For more information about using the <b class="bterm">Error</b> object, see <a href="inconHandlingErrors.htm" id="HV01039912" lcid=" ">Handling errors</a>.</p><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/xdobjError_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|