Development using InfoPath: Part II


Layouts:

This panel will have few layout templates

Controls:

This section consist of the InfoPath supported controls

Data source:

Primary and secondary data source will be shown here so you can drag them in to design

Design Checker:

Design checker help to check the design compatibility and data source error its simply like compiling the form

Publish form template:

This help in publishing the form to SharePoint, E-mail, Network Location or installable Form template (output will be MSI package and can be installed in server and client machine).

Business Logic

4.png
 

Development using Visual studio:

Before starting development using Visual studio we need some pre-requisition to be installed.

5.png

Setting the default coding language

InfoPath supports using either JScript or VBScript in a form, but you cannot mix the two programming languages in a single form. To set the default scripting language used in a form, click Form Options on the Tools menu in design mode. In the Programming category of the Forms Options dialog box, select the programming language in the Programming language list.

Creating an event handler

When writing scripting code in an InfoPath form, you will usually be writing code in one of the InfoPath form or data validation event handlers. How you create the event handlers depends on the type of event that you want to use. It is important that you initially create the event handlers in design modeâ€"InfoPath creates the declarations of the event handlers in the script file and makes entries in the form definition (.xsf) file that enable a form to use the event handlers.

The following table lists each of the InfoPath event handlers and the steps for creating them.
 

Event handler

Steps

OnLoad Event

On the Tools menu, point to Programming, and then click On Load Event.

OnSwitchView Event

On the Tools menu, point to Programming, and then click On Switch View Event.

OnBeforeChange Event

With a control selected, point to Programming on the Tools menu, and then click On Before Change Event.

The OnBeforeChange event handler can also be created by right-clicking a control, or a field in the Data Source task pane, then clicking On Before Change Event from the Programming list.

OnValidate Event

With a control selected, point to Programming on the Tools menu, and then click On Validate Event.

The OnValidate event handler can also be created by right-clicking a control, or a field in the Data Source task pane, then clicking On Validate Event from the Programming list.

OnAfterChange Event

With a control selected, point to Programming on the Tools menu, and then click On After Change Event.

The OnAfterChange event handler can also be created by right-clicking a control, or a field in the Data Source task pane, then clicking On After Change Event from the Programming list.

OnSubmitRequest Event

On the Tools menu, click Form Submit Options. In the Form Submit Options dialog box, click Allow users to submit this form, then click Perform custom action using code and press the Edit code button.

OnVersionUpgrade Event

On the Tools menu, click Form Options. In the Form Options dialog box, select the Versioning category, then select Use custom event in the On version upgrade list, then press the Edit button.

OnAfterImport Event

This event handler cannot be created in design mode. It must be created manually. See the OnAfterImport event for more information.

OnMergeRequest Event

On the Tools menu, click Form Options. In the Form Options dialog box, select the Advanced category, then select Merge using custom code in the Merge forms section, then press the Edit button.

OnSaveRequest Event

On the Tools menu, click Form Options. In the Form Options dialog box, select the Open and Save category, then select Save using custom code in the Save behavior, then press the Edit button.

OnSign Event

On the Tools menu, point to Programming, and then click On Sign Event.

OnContextChange Event

On the Tools menu, point to Programming, and then click On Context Change Event.