Wednesday, November 4, 2020

Submit form data to a microsoft sql server database

In this article

Overview

Step 1: Enable the submit data connection

Step 2: Configure the submit options

Overview

When you design a form template that is based on a Microsoft SQL Server database, the Data Connection Wizard enables a submit data connection to the database if the following conditions are met:

  • Forms that are based on this form template must be filled out by using Microsoft Office InfoPath. If the form will be filled out by using a Web browser, the form cannot submit data to a database directly. To configure a browser-compatible form template to submit data to a database, use a data connection that submits data to a Web service that works with the database.

  • The primary database table that is used in the main data connection contains a primary key, unique constraint, or unique index.

  • Any other database tables that are used with this main data connection have a simple relationship to the primary database table.

If the database meets these requirements, InfoPath enables the submit data connection and adds a Submit button to the Standard toolbar and a Submit command to the File menu on the form.

You can choose to disable the submit data connection in the wizard when you design a form template that is based on a database. If you disable the submit data connection in the wizard and then later you decide that you want to use this submit data connection, you can enable the submit data connection by modifying the main data connection. This article discusses how to enable that submit data connection.

Note: You can have a submit data connection only in the main data connection to a database. You cannot add a submit data connection to the form template that is a secondary data connection to a database. If you want to use a submit data connection to a database as a secondary data connection, use a Web service that works with the database, and then add a submit data connection to that Web service.

After you enable the submit data connection, you can also customize the submit options for your form template in the following ways:

  • Change the text that appears on the Submit button on the Standard toolbar and the Submit command on the File menu.

  • Change the keyboard shortcut for the Submit button on the Standard toolbar and the Submit command on the File menu.

  • Create custom messages to display to your users when they submit their forms.

  • Specify whether to leave the form open, close the form, or open another blank form after the form is submitted.

Top of Page

Step 1: Enable the submit data connection

  1. On the Tools menu, click Data Connections.

  2. In the Data Connections dialog box, click the main data connection, and then click Modify.

  3. In the Data Connection Wizard, click Next.

  4. On the next page of the wizard, select the Enable submit for this connection check box, and then click Finish.

Top of Page

Step 2: Configure the submit options

After you enable the submit data connection, InfoPath adds the Submit button to the Standard toolbar and the Submit command to the File menu. InfoPath also configures the forms that are based on this form template to display a message to users after they submit their completed forms. The message states whether the form was successfully submitted. By default, InfoPath also keeps the forms open after users submit them. To change the text that appears on the Submit button, as well as the behavior that occurs after users submit their forms, do the following:

  1. On the Tools menu, click Submit Options.

    1. To change the name of the Submit button that appears on the Standard toolbar and the Submit command that appears on the File menu when users fill out the form, type the new name in the Caption box in the Submit Options dialog box.

      Tip: If you want to assign a keyboard shortcut to this button and command, type an ampersand (&) before the character that you want to use as a keyboard shortcut. For example, to assign ALT+B as the keyboard shortcut for the Submit button and command, type Su&bmit.

  2. If you do not want people to use a Submit command or the Submit button on the Standard toolbar when they fill out your form, clear the Show the Submit menu item and the Submit toolbar button check box.

    1. By default, after users submit a form, InfoPath keeps the form open and displays a message to indicate if the form was successfully submitted. To change this default behavior, click Advanced, and then do one of the following:

      • To close the form or create a new blank form after the user submits a completed form, click the option that you want in the After submit list.

      • To create a custom message to indicate if the form was successfully submitted, select the Use custom messages check box, and then type your messages in the On success and On failure boxes.

        Tip: Use a message in the On failure box to tell users what to do if they cannot submit their form. For example, you can suggest that users save their form and contact someone for further instructions.

      • If you do not want to display a message after the user submits a form, clear the Show success and failure messages check box.

Top of Page

No comments:

Post a Comment