Overview of InfoPath Events

 <  Day Day Up  >  

The events available to programmers in InfoPath 2003 are very different from the events available to HTML forms developers, or to users of the newer W3C XML Events specification (see http://www.w3.org/TR/xml-events), which is designed for use with W3C XForms (see http://www.w3.org/TR/xforms) and other technologies.

For example, in InfoPath there are no events related to setting or removing focus from a form control. Nor are there events that respond to a keypress or to hovering the mouse pointer over a part of a form. The absence of such events that you may be familiar with when scripting in HTML/XHTML pages means you have to adjust your approach to interactivity and other events in InfoPath significantly. In fact, only one event (the OnClick event) responds solely to user action, and it's available only on the button form control. This limitation means that you probably must rethink how you create forms that provide all the interactivity and other functionality you want.

In addition to lacking familiar events, InfoPath also introduces several events likely to be wholly unfamiliar to you if your only coding experience has been scripting in HTML. Some of those events ” OnBeforeChange , OnValidate , and OnAfterChange ”relate specifically to the use of W3C XML Schema in the validation of the data source content of an InfoPath form.

Other events (for example, OnSwitchView ) are necessary because of features specific to InfoPath. The OnSwitchView event is necessary to respond to the existence of potentially multiple views in an InfoPath form. The versioning of InfoPath form templates necessitates the existence of the OnVersionUpgrade event.

EVENT NAMES ARE CASE SENSITIVE

All event names in InfoPath are case sensitive, unlike those in HTML or XHTML forms. Typically, event handlers in InfoPath are created using the InfoPath user interface, so those functions and subroutines will be given correctly cased names corresponding to the events. However, you must be careful not to introduce incorrectly cased event names ”for example, when conducting a search and replace in script code.


InfoPath 2003 has only nine events. InfoPath events can be classified into two groups:

  • Form events occur in response to something that the form or user of the form does.

  • Validation events occur in response to attempts to modify data in the XML DOM structure that underlies an InfoPath 2003 form.

GETTING HELP WITH FORM EVENTS

Entering "events" or "form events" fails to show relevant help information in InfoPath 2003. The form events in InfoPath are described in detail in the InfoPath Developer's Guide. To access this information, press F1 to open the InfoPath Help task pane, select Table of Contents, scroll down and click on InfoPath Developer's Reference, click on InfoPath Object Model Reference, and finally click on Events to reveal a list of links to information about each event.

If you have the Script Editor open, you will have access to the best help on events in the extensive Script Editor Help files.


 <  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