Insert a button InfoPath 2007

Author: mety Nagm Labels::

You can insert a button, sometimes referred to as a command button or push button, on a Microsoft Office InfoPath form template. Users click buttons to initiate an immediate action, such as submitting a form to a Web service or querying a database. You can associate a button with rules (rule: A condition or action, or a set of conditions or actions, that automatically performs tasks based on events and values in the form.) or custom code that runs when a user clicks the button.

When to use a button

Buttons are versatile controls that are useful in many different scenarios. For example, you can use a button when you want to:
If you know how to write code, you can use a button to perform more sophisticated actions or to do things that are not supported in the user interface in design mode. For example, you can use code to automatically delete all the rows in a repeating table when a user clicks a Delete All button.
If you design your form template so that it submits data to a database or other external data source, then a Submit command on the File menu and a Submit toolbar button will be added to the form. However, those submission points are easy for users to miss. Therefore, you may want to consider adding a Submit button to your form template. The following illustration shows how that might look on a user's form.
Submit button on form
When you add a button to your form template, by default, InfoPath inserts a button with "Button" as the text that appears on the control. If you want to change the text and assign an action to the button by using a rule, you must double-click the button and specify options in the Button Properties dialog box.
If you want the text on the button to change depending on values on the form, you can create a dynamic button label. For example, you can create a button with the label Send To Manager, where Manager is the name that a user types in a Manager text box elsewhere on the form.

Insert a button

The procedure for inserting a button is the same whether you are designing a new, blank form template or basing the design of your form template on a database or other external data source.
The following illustration shows how a button looks when it is selected in design mode (design mode: The InfoPath design environment in which you can create or modify a form template.).
Button selected in design mode
Unlike most other InfoPath controls, buttons are not bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to fields (field: An element or attribute in the data source that can contain data. If the field is an element, it can contain attribute fields. Fields store the data that is entered into controls.) or groups (group: An element in the data source that can contain fields and other groups. Controls that contain other controls, such as repeating tables and sections, are bound to groups.) in the data source. This is because they are used to initiate an action, not to collect data from the user.

Insert a button

  1. On the form template, place the cursor where you want to insert the control.
  2. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.
  3. Under Insert controls, click Button.
  4. Double-click the button icon that was inserted onto your form template.
  5. Click the General tab.
  6. In the Action list, 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 template was designed and whether the form template includes a data connection that queries or submits data to external data sources, such as a database or Web service.
    SubmitThis 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 CodeThis 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 QueryIf the form is connected to a database or Web service, this action queries a database or Web service based on the values entered in the fields that are used to query the data.
    New RecordIf the form is connected to a database or Web service, this action clears the values on the form so that a user can enter new data.
    Delete & SubmitIf 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.
    RefreshIf 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.
    Update FormIn a form that is designed to be filled out in a Web browser, this action updates form data in an incremental manner. For example, imagine a Total box that changes based on the values that users enter in other controls on the form. To avoid refreshing the form whenever the values in those controls change, you can prevent data from being sent to the server for those specific controls. You can then add an Update Totals button next to the Total box, which the user can click to manually refresh the totals. The button associated with the Update Form action is visible only when users display and fill out the form in the browser.

  7. In the Label box, do one of the following:
    • To use custom text on the button, type the text that you want to display.
    • To use a value from the form for the button text, click Insert Formula Button image. In the Insert Formula dialog box, click Insert Field or Group, and then select the field or group that you want to use.

Layout tips

Use the following tips to help you refine the appearance, size, and other aspects of a button control:
  • Buttons tend to look best when their labels are only a few words long.
  • To change the size of several buttons at once, select the buttons whose size you want to change. Press ALT+ENTER, and then make the necessary adjustments on the Size tab.
  • To change the border or color of a button, select the button that you want to change. On the Format menu, click Borders and Shading, and then make the necessary adjustments.
  • It is not possible to add an image to a button in design mode. To work around this limitation, you can manually edit the manifest (.xsf) file that is associated with the form template, although this method is recommended only for advanced form designers.
  • If you use the same button in more than one view, try to place it in a similar location in each view and use the same button text for consistency.
  • For a more polished look, consider limiting the number of different widths you use for the buttons in your form template. Also, try to avoid using narrow, short, or tall buttons, because non-standard button sizes often look unprofessional.



Blog Archive

Powered by Blogger.

I made these pages for me and my friends to help solving the problem we face regarding Computer & internet, if anyone wants me to answer a question or find out about some information please send me email and I will try to reply.*P.S. some of the article I wrote and the other I found on the internet I posted them in sprit of learning and shearing, please forgive me if you found something you don’t want to be in my blog, email me and I will delete them. Thank you for your interest in my pages.امل نجم Amal Nagm

banner 1 banner 2