data is data that has an exptected format or is of an expected type.For example, you can check whether the data a user has entered has the correct format for a phone number or that it is a number. For information on how to add event handlers in Info Path design mode, see How to: Add an Event Handler. When you add an event handler to your form template from the design mode user interface, Microsoft Office Info Path 2007 generates code in the Internal Startup method of your form code file using the Event Manager class and the member of the Xml Event class to bind document-level events to their event handlers.The Info Path hosted control gives developers of third party hosted applications the ability to respond to events in the form.The Info Path event manager provides this functionality.Much of the scripting code you might have written for HTML/XHTML forms is unnecessary in Info Path forms, because data validation is an important focus in HTML forms.
Step 1: Implement an Internal Startup method First, add code to handle the Internal Startup event.
Info Path (in microsoft.office.infopath.dll)The Validating event is not meant to be instantiated by the developer in form code.
This event handler does not allow users to cancel an operation.
There are 3 ways to validate data in Info Path: If you add a Text Box control to an Info Path form template and set its Data type to be Whole Number (integer), Info Path will display a red border around the control if you type anything that is not a whole number into that field.
In addition, an error tooltip will appear that says: You can define Conditions under which data that is entered into a field should be considered invalid or you can write code in the Validation event of a field to check whether the data entered is valid.