Insert a button
You can create a button on your form to make it easy for users to perform common tasks, such as submitting a form to a Web service or querying a database. You can also associate a button with rules or custom code that runs when a user clicks the button.
- In design mode, place the insertion point where you want to insert the button.
- If the Controls task pane is not visible, click More Controls on the Insert menu.
- In the Insert controls list in the Controls task pane, click Button.
- Double-click the button icon that was inserted onto your form, and then,
in the Action
list in the Button Properties dialog box, click the action that you want the button to perform.
The Submit and Rules and Custom Code actions are always available. The availability of other button actions depends on how the form was designed and whether the form includes a data connection to external sources of data, such as databases or Web services.
- Submit This action initiates the standard submit functionality for the form
— this is the same as the user clicking Submit on the File menu. To initiate a custom submit action, select Rules and Custom Code, and then create a rule for submitting the data. - Rules and Custom Code This action either runs a rule when the button is clicked or runs custom code. For example, you can create a rule that automatically submits the data from a form to a Web service or submits the data as an e-mail message, in response to the user clicking the button. To define a rule, click Rules. To define code, click Edit Form Code.
- Run Query If the form is connected to a database or Web service, this action queries a database or Web service based on the values of the query fields.
- New Record If the form is connected to a database or Web service, this action clears the values on the form so that a user can enter a new record.
- Delete & Submit If the form is connected to a database or Web service, this action deletes the records from the database that have been returned in a query.
- Refresh If the form is connected to a database or Web service, this action refreshes the data from the database or Web service that has been returned in a query.
- Submit This action initiates the standard submit functionality for the form
- In the Label box, type the text that you want to appear on the button.
Note The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more