File: xdmthReportError.htm

package info (click to toggle)
office2003-schemas 1.0%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 42,304 kB
  • sloc: javascript: 2,429; makefile: 29
file content (43 lines) | stat: -rw-r--r-- 6,648 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01021405"><META NAME="lcid" CONTENT="1033"><title>ReportError Method</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>ReportError Method</h1><DIV class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="appliesto" onclick="toggleList()" onkeypress="toggleList()"></span><a class="ofvbanavex" href="#example"><span class="ofvbanavreuse" id="example"></span></a><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></DIV><p>
      <p>Creates an <b class="bterm"><a href="xdobjError.htm" id="HV01021243" lcid=" ">Error</a></b> object and adds it to the <b class="bterm"><a href="xdcolErrors.htm" id="HV01021186" lcid=" ">Errors</a></b> collection.</p>
      
        <p class="signature"><i>expression</i>.<b class="bterm">ReportError</b>(ByVal <b class="bterm"><i>varNode</i></b> As Variant, ByVal <b class="bterm"><i>bstrShortErrorMessage</i></b> As String, ByVal <b class="bterm"><i>fSiteIndependent</i></b> As Boolean, [ByVal <b class="bterm"><i>bstrDetailedErrorMessage</i></b> As String], [ByVal <b class="bterm"><i>lErrorCode</i></b> As Long], [ByVal <b class="bterm"><i>bstrType</i></b> As String = "modeless"]) As Error</p>
        <p><i>expression   </i> Required. Returns a reference to the <b class="bterm"><a href="xdobjDataDOMEvent.htm" id="HV01021239" lcid=" ">DataDOMEvent</a></b> object.</p><p>
          <i><b class="bterm">
            varNode</b>   </i> Required <b class="bterm">Variant</b>. The XML <a href="#" class="glossary" onclick="AppendPopup(this,'ofdocumentobjectmodeldom')" onkeypress="AppendPopup(this,'ofdocumentobjectmodeldom')">Document Object Model (DOM)</a> node that the error is associated with.</p>
        <p>
          <i><b class="bterm">
            bstrShortErrorMessage</b>   </i> Required <b class="bterm">String</b>. The text to be used for the short error message.</p>
        <p>
          <i><b class="bterm">
            fSiteIndependent</b>   </i> Optional <b class="bterm">Boolean</b>. Sets the condition for automatic deletion of the <b class="bterm">Error</b> object. If <b class="bterm">True</b>, the <b class="bterm">Error</b> object will be deleted on change for any nodes that matched the XPath expression corresponding to the <b class="bterm">Error</b> object. If <b class="bterm">False</b>, the <b class="bterm">Error</b> object will be deleted when the node returned by the <b class="bterm">Site</b> property of a given  event object has been changed.</p>
        <p>
          
            <i><b class="bterm">bstrDetailedErrorMessage</b>   </i> Optional <b class="bterm">String</b>. The text to be used for the detailed error message.</p>
        <p>
          <i><b class="bterm">
            lErrorCode</b>   </i> Optional <b class="bterm">Long</b>. The number to be used as the error code.</p>
      <p><i><b class="bterm">bstrType</b>   </i> Optional <b class="bterm">String</b>. Default value is "modeless". Determines whether the change in value will be automatically rejected or whether the user will be prompted to accept or reject the change. The other value is "modal".</p><p><i>returns   </i> A reference to an <b class="bterm">Error</b> object.</p>
    </p><h2>Security Level</h2><p>2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.</p><h2>Remarks</h2><p>
      <p>When the <b class="bterm">ReportError</b> method of the <b class="bterm">DataDOMEvent</b> object is called, Microsoft Office InfoPath 2003 creates an <b class="bterm">Error</b> object and adds it to the <b class="bterm">Errors</b> collection. Errors are removed from the collection when the validation constraint is no longer invalid, or when they are explicitly removed using the <b class="bterm"><a href="xdmthDelete.htm" id="HV01021382" lcid=" ">Delete</a></b> or <b class="bterm"><a href="xdmthDeleteAll.htm" id="HV01021383" lcid=" ">DeleteAll</a></b> methods of the <b class="bterm">Errors</b> collection.</p>
    <p>Errors can also be created using the <b class="bterm"><a href="xdmthAdd.htm" id="HV01021375" lcid=" ">Add</a></b> method of the <b class="bterm">Errors</b> collection.<p><b>Note</b>  Site-independent errors should be used when you want the errors to apply to all XML DOM nodes of the same type. If you want the error to apply to a specific XML DOM node, use site-dependent errors.</p></p></p><h2><a id="#example" name="#example">Example</a></h2><p>
      <p>In the following example from the Data Validation developer sample form, the <b class="bterm">ReportError</b> method of the <b class="bterm">DataDOMEvent</b> object is used to create a custom error and add it to the errors collection:</p>
      <pre><code>function msoxd__total::OnValidate(eventObj)
{
   if (parseInt(eventObj.Site.nodeTypedValue, 10) &gt; 75)
      eventObj.<b class="bterm">ReportError</b>(eventObj.Site, "The total is too high.  " +
         "The total number of blocks cannot be greater than 75.", false);

   if (parseInt(eventObj.Site.nodeTypedValue, 10) &lt; 0)
      eventObj.<b class="bterm">ReportError</b>(eventObj.Site, "The total is too low.  " +
         The total number of blocks cannot be less than 0.", false);
}</code></pre>
    </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/xdmthReportError_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">&copy;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&amp;CTT=11&amp;Origin=HV011232471033" 

target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>