Submitting an InfoPath Form

 < Day Day Up > 

Submitting an InfoPath form is relevant only in form-filling mode. InfoPath 2003 provides three ways that you can provide submission functionality for form users:

  • Submit via the File menu

  • Submit via an InfoPath action

  • Submit via a script

The target to which you submit a form can include a relational database such as SQL Server or Microsoft Access, or an XML Web service.

Submitting Via the File Menu

By default, the user can submit a form by clicking on the File menu and selecting Submit. However, the form designer can enable or disable this means of submitting a form.

To control whether the end user can submit a form, you must open the Submitting Forms window in design mode. To do so, follow these steps:

  1. Right-click on a button form control and select Button Properties.

  2. Select the Submit action on the General tab of the Button Properties window (see Figure 9.14).

    Figure 9.14. Selecting the Submit option in the Button Properties window.

    graphics/09fig14.gif

  3. Click the Define Action Parameters button, and the Submitting Forms window opens (see Figure 9.15).

    Figure 9.15. The Submitting Forms window.

    graphics/09fig15.gif

On the Submitting Forms window, you can allow or disallow the submission of forms created from the form template. The Enable Submit and Do Not Enable Submit option buttons are self-explanatory.

Similarly, you can enable (the default) or disable the Submit option on the File menu. To disable the Submit option, uncheck the Enable the Submit Menu Item on the File Menu option. If the Submit option is disabled, the corresponding option on the File menu is grayed out when the form is previewed or opened in form-filling mode.

KEYBOARD SHORTCUT TO SUBMIT

When the submission of forms via the File menu is enabled, you can define a keyboard shortcut to submit a form. The default keyboard shortcut is to press Alt+F (which selects the File menu) and then to press B. If you want to change the latter part of the keyboard shortcut, delete the ampersand (&) before the b of the word Submit in the Submitting Forms dialog box and place it before another letter.


Other Submit Destinations

The Submitting Forms window also lets you choose other submission destinations, including a Web service, a custom script, or HTTP. These additional destinations apply whether the Submit option on the File menu or the InfoPath Action is being used (described in the next section).

Depending on which submission target you choose, additional options might be displayed on the Submitting Forms window. If you select the Submit to a Web Service option, the Select a Web Service button appears (see Figure 9.16).

Figure 9.16. The Submit to a Web Service option in the Submitting Forms window.

graphics/09fig16.gif

Clicking the Select a Web Service button opens the Submit to Web Services Wizard window (see Figure 9.17), where you can either type in the URL for a WSDL file or use the Search UDDI button to locate a suitable XML Web service. Clicking the Search UDDI button opens the Search Web Service window, which was discussed in Chapter 8, "Connecting to a Web Service."

Figure 9.17. The Submit to Web Services Wizard window.

graphics/09fig17.gif

Another option on the Submit drop-down menu in the Submitting Forms window is Submit Using Custom Script. If you choose that option, the Open Microsoft Script Editor check box appears, which is checked by default (see Figure 9.18). If you leave the check box checked, clicking the OK button on the Submitting Forms window causes the Microsoft Script Editor to open.

Figure 9.18. The Submit Using Custom Script option.

graphics/09fig18.gif

The final option in the Submit drop-down menu is Submit Through HTTP. When that option is selected, a URL text box appears, into which the URL for submission is entered (see Figure 9.19).

Figure 9.19. The Submit Through HTTP option in the Submitting Forms window.

graphics/09fig19.gif

Submitting Via InfoPath Action

The control of submission via InfoPath action is also controlled via the Button Properties window (shown earlier in Figure 9.14). Select the Submit option in the drop-down menu, and then click OK. The Submitting Forms window opens with options as previously described.

Submitting Via Script

One of the options on the Action drop-down menu of the General tab of the Button Properties window is Script. When this option is selected, the options offered on the General tab of the Button Properties window change (see Figure 9.20).

Figure 9.20. Additional script options on the General tab of the Button Properties window.

graphics/09fig20.gif

The value in the Label text box changes, by default, to Script . Depending on precisely what you want to do, you will likely want to change that to something more meaningful. The button form control is also allocated a Script ID, which is a name used to create the name of the relevant function in the script code in the Microsoft Script Editor. It is sensible to change the automatically generated script ID to something meaningful, like FormSubmit rather than, say, CTRL3_7 . That means that the JScript function name, assuming you are using JScript, automatically created in the Microsoft Script Editor is created as FormSubmit::OnClick rather than the less meaningful CTRL3_7::OnClick .

The Microsoft Script Editor button opens the Microsoft Script Editor when clicked.

Specifying the Behavior After Submitting a Form

Having looked at the available ways to submit a form, we also need to look briefly at how we can specify what happens after a form is submitted. Those options are as follows :

  • Close the form

  • Create a new, blank form (from the same form template)

  • Leave the form open

To make a choice about those options, you need to access the Submit Options window. On the Button Properties window, with Submit selected in the Action drop-down menu, click Define Action Parameters (the Submitting Forms window opens). On the Submitting Forms window, click the Submit Options button to open the Submit Options window (see Figure 9.21).

Figure 9.21. The Submit Options window.

graphics/09fig21.gif

In addition to these options offered by InfoPath, you can script alternative behavior after submitting a form.

The bottom section of the Submit Options window allows the form designer to use form submission success/failure messages, and also allows for the creation of custom success/failure messages.

 < 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