1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  
     | 
    
      <html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01027390"><META NAME="lcid" CONTENT="1033"><title>Control events in the Events developer sample form</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>Control events in the Events developer sample form</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><p>The Events developer sample form implements a single Microsoft
			Office InfoPath 2003 control event that can respond to a button click;
			this is the <b class="bterm"><a href="xdevtOnClick.htm" id="HV01027661" lcid=" ">OnClick</a></b> event. The <b class="bterm">OnClick</b> event occurs after a user clicks a button on a form.</p><p><b>Note</b>  The <b class="bterm">OnClick</b> event is the only control event supported by InfoPath.</p><p>To use the <b class="bterm">OnClick</b> event, you must first create the event in the <b class="ui">Button Properties</b> dialog box that is available on the shortcut menu for the button control. On the <b class="ui">General</b> tab, set <b class="bterm">Script</b> as the <b class="ui">Action</b>, and then click
			<b class="ui">Microsoft Script Editor</b>. This will open
			<a href="#" class="glossary" onclick="AppendPopup(this,'xdmicrosoftscripteditormse')" onkeypress="AppendPopup(this,'xdmicrosoftscripteditormse')">Microsoft Script Editor (MSE)</a> and display the InfoPath-generated <a href="#" class="glossary" onclick="AppendPopup(this,'xdeventhandler')" onkeypress="AppendPopup(this,'xdeventhandler')">event handler</a>.</p><p><b>Note</b>  Event handlers in InfoPath must be created in <a href="#" class="glossary" onclick="AppendPopup(this,'xddesignmode')" onkeypress="AppendPopup(this,'xddesignmode')">design mode</a>.</p><p>In the Events developer sample form, the <b class="bterm">OnClick</b> event is implemented for the three buttons that are used to switch between views. The following example from the Events developer sample form shows the <b class="bterm">OnClick</b> event handler for the <b class="ui">Switch to New Customer View</b> button:</p><pre><code>function btnSwitchNew::OnClick(eventObj)
{
   XDocument.View.SwitchView("New Customer")
}</code></pre><p><b>Note</b>  The name of the button used in the event handler declaration is determined by the value set for the <b class="ui">Script ID</b>
			box in the <b class="ui">Button Properties</b> dialog box.</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/inconControlEventsInEVTForm_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> 
     |