RedCape's Blog

Technology Tips

Archive for the month “September, 2010”

Create a Submit Button in an InfoPath Form to Email Recipients

After a user completes a form, you can create a Submit button configured to instantly send the form by email.

  1. With your form in Design view, click in the area of the form you wish to add the Submit button.
  2. Display the Controls task pane and click the Button control, which places the button in the form.
  3. Double-click the button to launch its properties. On the General tab, the default Action setting is Rules and Custom Code, which is not what we want.

  4. Change the Action drop down box to Submit.

  5. Now click the Submit Options button to launch the Submit Options dialog box.

  6. Click the Allow users to submit this form option.

  7. In the Data Connections widow, click the Add button to add a data connection.

  8. In the Data Connection Wizard, choose Create a new connection to as well as Submit Data and click Next.

  9. Choose As an e-mail message and click Next.

  10. Complete the email fields as seen in this screenshot. If you want to use a field from your form, click the corresponding Insert Formula
    [fx] button in this dialog box. For instance, if you collected the user’s email address on this form, you can include them in the cc field of the email. See step a, below.

    1. When you click the Insert Function button for the Cc: field of the email, you get the Insert Formula dialog box.

    2. In the Select a Field or Group dialog box, choose your emailAddress field you created in your form and click OK twice to get back to the Data Connection wizard.

  11. Once your email address fields, subject and introduction fields are completed, click Next.

  12. Choose Send only the active view of the form and no attachment, then click Next.

  13. You can rename the data connection or accept the default “Email Submit” name. Click Finish.

  14. Now you’re brought back to the Data Connections wizard where you see your Email Submit connection along with a preview of its properties. Click Close.

  15. To complete the setup, click the Ok button in the Button Properties dialog box.

  16. The next step is to Preview the form so that you can test your new Submit button.

When InfoPath controls are missing from the Controls task pane

If you examine the two Controls task panes below, it’s apparent that the one on the right is missing a handful of controls. This is most likely due to the compatibility settings. To confirm this, look towards the bottom of the Controls task pane for the message “Some controls have been hidden based on the current compatibility settings” as seen in the next screenshot. If you don’t want the form completed by the user in a browser, you can turn off the compatibility settings by following the steps below. For more information about compatibility settings, review this helpful article on Office Online.









 Steps to turn off Compatibility Settings

  1. Change the task pane to Design Checker and click the Change Compatibility Settings link to launch the Forms Options window.

  2. In the Form Options window, uncheck the Design a form template that can be opened in a browser or InfoPath option and click OK.

  3. Change the task pane to the Controls task pane and you should see all the available controls.

Hide custom Views in InfoPath

Suppose you’ve created several views for your InfoPath form, such as: Customer (default), Accounting and Customer Support. The majority of the fields are located on the default Customer view. Accounting related fields are on the Accounting view as well as “For Office Use” only fields. And Customer Support has their own view for data relating to the customer’s products and services.

You’ve set up Rules to assign the departments to the specific views through the Tools > Form Options dialog box > Open Behavior > Rules window.

But that doesn’t prevent anyone from going to the View menu and switching to another view as you can see in this screenshot.

Because the accounting information is sensitive, you may want to hide the Accounting and default Customer view. To hide a view from the View menu, launch the View Properties for the view and uncheck Show on the View menu when filling out the form. It is checked by default. Simply uncheck it and click Ok.

Create a Default Format to Capitalize Name Fields in InfoPath

When you have name fields in your form, you can force InfoPath to autoformat the capitalization of those fields so that the first letter of the name is properly capitalized. Thanks to S.Y.M. Wong-A-Ton’s article for the tip. Here are the step by step instructions for setting the default format on a name field. Use this on any control you need proper case.

  1. As you can see, I have the two name fields in my form: First Name and Last Name.

  2. Double-click the First Name field to launch the Text Box Properties dialog box. Then click the Function button to the right of the Default Value property.

  3. Copy and paste the following code in the Formula area

    concat(translate(substring(., 1, 1), “abcdefghijklmnopqrstuvwxyz”, “ABCDEFGHIJKLMNOPQRSTUVWXYZ”), substring(., 2, string-length(.) – 1))

    Your window should look like this. Click OK twice.

  4. Test the field by using Preview mode.

Create a Reusable Template Part in InfoPath 2007

If you find that you create the same layout and controls on multiple forms, you should consider creating a template part that can be reused over and over again. This is also valuable if you are a member of team that creates a variety of forms including ones that include similar elements such as the header plus controls to collect employee information such as [Employee Name], [Job Title], [Department], [Email], and [Location]. One person on the HR team can create the layout and controls, save it as a template part and then allow anyone on the team to use it in their forms, thereby reducing significant time and potential errors.

There are three major steps in creating the Template Part:

Step A: Create and save the Template Part.
Step B: Add the Template Part as a custom control to your form. [Skip to this step]
Step C: Place the Template Part in your form. [Skip to this step]

Step A: Create and save the Template Part

  1. Launch InfoPath 2007.
  2. In the Getting Started window, choose Design a Form Template… from the Design a Form section.

  3. In the Design a Form Template window, select Template Part under Design a new: and click OK.

  4. Notice the title bar. It should say (Template Part Design) TemplateGroup1. If so, click Layout on the Design Tasks task pane.

  5. For this example, add Table with Title for our form title and then Two-Column Table for our employee controls.

  6. Your form should now look like this:

  7. Type your information into the tables and format your text:

  8. Insert your controls to match the data you need.

  9. Don’t forget to update the properties of each control to include the control’s name. To do this, right-click the control that applies to the employee name and choose Text Box Properties. Change the Field name: property to employeename and click Ok. Give each one of the controls a unique and relevant name.

  10. Once you complete the setup process, it’s time to save it to a shared location for others to use. In this example, I saved the template part as HREmployeeHeader with the default xtp extension. Be sure to post the file in a location where your team members can access it as well. This concludes Step A.

Step B: Add the Template Part as a custom control to your form.

  1. Open a new form template or open existing form template to which you’d like to add the Template Part.
  2. In the Task Pane, click the Controls link. Towards the bottom of the Controls task pane there is a link Add or Remove Custom Controls. Click that link.

  3. In the Add or Remove Custom Controls window, click Add.

  4. Click Template Part and then click Next

  5. Browse to navigate to the location of your saved Template Part and click Finish.

  6. You’ll receive confirmation of the added part. Click Close.

  7. You can add more Template Parts at this point. If you don’t have any more Templates to add, then click Ok.

  8. You should see the new Template Part in the Custom section of you Controls task pane. This completes Step B.

Step C: Place the Template Part in your form.

  1. Once you see the Template Part listed in your Controls task pane under the Custom section, you can add it to your form by simply clicking once on the name of the Template Part in the task pane. Notice the Template Part gets placed in its own Section.

Note: If your Template Part needs to be modified go ahead and make the changes and save it. The next step is to remove the Template Part control from the Task Pane of the form that is using the Template and add it back. The old control in your form will have an icon in the top right hand corner of your table indicating a new version of the template is available. Right click the “section” (versus the icon) and choose Update.

Additional Resources:

  • Video Tutorial from Microsoft: This video includes steps for refreshing the imported Template Part control when the Template Part is modified.
  • Article by Itay Shakury: Get the current user without writing code. Want to save even more time? Create a reusable Template Part (in Step A above) that automatically populates the employee’s information in the form!
  • Article from Microsoft: How to article and more details about what can and cannot be used in a Template Part.

Post Navigation

%d bloggers like this: