Add Submit Options
Solution: From the File menu, select Info. On the Info page, click the Submit Form button.
Several options appear (as shown in Figure 2.7):
- To Email: Submitting this form will send the contents in an email to a specified address.
- To SharePoint Library: Submitting this form will send the contents as a saved instance of the form in a SharePoint form library.
- To Web Service: Submitting this form will send the form as XML to a web service.
- To SharePoint Server Connection: Submitting this form will use a specified data connection stored in SharePoint to submit the data.
- Submit Options: If you are familiar with InfoPath 2007 or just want to take control of the submit options, use this item menu to just get down to business.
Figure 2.7 Submit options determine where and how a completed form will be submitted.
For this scenario, let's just select To SharePoint Library. The Data Connection Wizard appears. For the form to be submitted to that form library, you need to have a data connection to the SharePoint library in the form.
You can create the form library right from InfoPath, as explained in a later section.
Now that some of the grunt work has been done, we come to the most important part of the submission to a document library: the filename. If you notice, by default, the filename is Form. That's great. If you leave it like that, only one person can submit the form, it will be called Form.xsn in the form library, and no one ever can submit the form again. Let's go home!
You need to specify something dynamic or unique about the form instance the user is submitting. This can be tricky. You must define a formula to implement this correctly, and although we haven't stepped through formulas yet, we are forced to do at least one here.
The main ingredients for specifying the filename correctly deal with either entries in the form or entries in the form combined with a system function such as the date.
For this example, we will use the name the user entered in the form along with a date function. To do so, follow these steps:
- Click the Function button to the right of the File Name text box. The Insert Formula dialog appears.
- Click the Insert Function button and select the concat function. Click OK. The function inserts three spots for you to modify.
- Double-click the first entry and select the Name field from the field dialog that appears and click OK.
- Only select the next entry (don't double-click) and replace it with " - ", including the quotes.
- Select the last entry and click the Insert Function button. Select Today from the Date category.
- Click OK.
- Remove the Double-Click to Insert Field text if it still appears. Click OK. Your formula should now look similar to Figure 2.8.
Figure 2.8 Using a formula for the filename ensures that each instance is saved to a unique file.
- Click Next. If you are prompted for credentials, enter them accordingly.
- Click Finish to save the connection in the form.