| Applies to |
| Microsoft Office InfoPath™ 2003 |
When you use InfoPath to collect data as part of a larger business process, that data usually doesn't stay in the form. Instead, it moves to the next stage in that process, such as a database, Web service, or Web server. For example, an employee might use InfoPath to fill out an invoice form and then submit that form to a customer database to place the order. Another employee might use InfoPath to fill out a status report form and then submit it to an internal Web server, where it can be merged with other status report forms.
Submitting a form is an efficient and accurate way of sending data from an InfoPath form to another program. When you design a form and enable form submission, you can choose to submit the data to different types of locations, including Web services and databases. In addition, form submission provides an extra layer of error-checking for users filling out forms, since forms with validation errors cannot be submitted until the errors are resolved. Finally, as a form designer, enabling form submission gives you more control over how the data collected in your form moves from InfoPath to the next step in the business process. For example, unlike saving a form, where users choose a storage location, submitting a form sends the form's data to a specific location that was defined when the form was designed.
Forms can be submitted to a Microsoft Office Access 2003 or Microsoft SQL Server™ database, to a Web service, or by using HTTP to a Web server. In addition, you can customize some of the options associated with form submission, including adding a Submit button, adding a failure or success message that is displayed to users when they submit the form, and specifying whether the form should close or a new copy of the form should open after it is submitted. You can also work with script to further customize how a form is submitted.
Note Microsoft Office InfoPath 2003 Service Pack 1 includes a number of features that make it easier to design, publish, and fill out forms, including improvements to form submission. If you install the service pack, you can submit forms as e-mail messages or send them directly to a Microsoft Windows® SharePoint® Services form library (form library: A folder in which a collection of forms based on the same template is stored and shared. Each form in a form library is associated with user-defined information that is displayed in the content listing for that library.) without writing script. In addition, you can submit form data to Web services that use ADO.NET DataSets. To learn more about the service pack and how to download it, see Upgrading to Microsoft Office InfoPath 2003 Service Pack 1.
Submitting a form to an Access or SQL Server database
InfoPath forms are frequently submitted to databases, whether it's to update a single table with a customer record or for more complicated scenarios, such as modifying multiple tables that are linked together in an expense report. InfoPath forms can be submitted directly to an Access or SQL Server database without script. You can also submit data to other types of databases by using script or by submitting the form to a Web service that is connected to that database.
In order to submit a form to an Access or SQL Server database, you must start with a new form and design it based on that database. If you add a database connection to an existing form, you won't be able to submit it to the Access or SQL Server database. This requirement exists so that InfoPath can create forms that match the structure of the database. If the form does not match the structure of the database, then InfoPath cannot update the correct fields in the database when the data is submitted.
When you connect an InfoPath form to a database, note the following issues:
- When you connect the form to more than one table in the database, the tables must be connected by key fields.
- Long data types, including Memo and Hyperlink, should be excluded from the data connection. InfoPath does not support data connections to long data types. To exclude specific fields in the database, use the Data Source Wizard to set up the data connection.
You can determine whether either of these issues applies to you by reading the information in the Summary box on the last page of the Data Source Wizard. The box will specify whether form submission is enabled; if it's disabled, the box will specify why.
After you set up the data connection between the form and the database, you can add a Submit button to the form and customize any other Submit options you want.
For detailed instructions on setting up submission to a database, see Enable form submission. For detailed instructions on designing a form connected to an Access database, see Design a form connected to a database and How-to guide: Connecting an InfoPath form to an Access database.
Submitting a form to a Web service
Whether you use a Web service to establish a workflow for a business process or as a middle tier on top of your database, InfoPath makes it easy to create forms that interact with the Web service.
There are two common methods of submitting forms to a Web service: connecting an existing form to a Web service and designing a new form based on the Web service. When you connect an existing form to a Web service, the structure of the form's data must correspond to what the Web service expects. When you design a new form that is connected to a Web service, InfoPath builds the form's data structure based on that Web service. The resulting form can then be used to submit data to and query the Web service.
Technical details
When you connect an InfoPath form to a Web service, note the following issues:
After the data connection to the Web service is set up, you can add a Submit button to the form and customize any other Submit options you want.
For detailed instructions on setting up submission to a Web service, see Enable form submission. For detailed instructions on designing a form connected to a Web service, see Design a form connected to a Web service.
Submitting a form by using HTTP
If you have an existing Active Server Pages (ASP) page or other code on a Web server, you can submit InfoPath forms to that Web server by using HTTP. This type of submission results in a standard POST, which the Web server then parses. When a user submits a form to the Web server, InfoPath sends the form as XML data in the body of an HTTP POST request to the specified URL.
Submitting a form by using HTTP requires code on the server in order to process the form. If you specify a URL for a server that does not contain that code, the submission will not work.
For detailed instructions on setting up submission by using HTTP to a Web server, see Enable form submission.
Submitting a form by using custom script
You can write custom script to create advanced functionality for submitting forms — for example, you can add functionality that enables form submission to more than one location or automatically modifies the data before the form is submitted.
For detailed instructions on setting up submission by using custom script, see Enable form submission.
Customizing submission options
Whenever you design a form that can be submitted to a database, Web service, or Web server, InfoPath enables the Submit command on the File menu by default. Depending on your needs, you can choose to modify the Submit command. In addition, you can insert a button directly on the form that users can click to submit the data after they finish filling out the form.
You can also set up your form so that one of the following occurs after the form is submitted: The existing form closes, the existing form closes and a new, blank form opens, or the existing form remains open. In addition, you can write a message that appears after users submit their form, specifying whether the form was submitted successfully.
For detailed instructions on customizing submission options, see Set options for form submission.
Conclusion
Form submission can increase the accuracy and efficiency of your business processes because it allows you to exert more control over those processes. In addition, form submission gives you more options for reusing the data collected in InfoPath forms, and enabling form submission does not take away any of the functionality in InfoPath. Even when a form is connected to a database or Web service, for example, users can save the form to their computers, work on it offline, and then submit it after they reconnect to the network.