I recently found the need to submit and save Infopath 2007 browser enabled form data. The submit is very straight forward when using browser enabled forms, but the ability to save the form is not so straight forward or so you might think. After thinking for a little while on how to work around the save capability I found a very simple process to allow users to Submit and Save InfoPath Browser enabled forms back to the SharePoint Library without any custom code.
Designing the Form
- Begin by creating an InfoPath 2007 form with a button and some text box control(s).
- Add an additional Data Source called submitFormName
Add a Data Connection
Create the Data Source Connection that will allow the form to be submitted to the SharePoint site using the following steps.
- Click on the Manage Data Connections… and then click the Add button
- Select Create a new connection to: and Submit Data then click Next >
- On the next screen Select a destination for submitting your data choose the To a document library on a SharePoint site then choose next
- Now provide a URL to the document library you want to submit your data to. In the next to the file name textbox click on the fx button. Click on the Insert Field or Group… button and select the submitFormName field.
- Click the OK button on the Select a Field or Group window and on the Insert Formula Window. On the data connection wizard check the Allow overwrite if file exists option. Click Next >.
- You can now provide a custom name for your data connection then click Next >.
- Click Close on the Data Connections windowAdd the actions to the Custom Button
- Double Click on the button control added to the InfoPath form
Select Rules and Custom Code for the Action and provide a label and control ID, if desired, of your choice.
Click on the Rules… button and then click on the Add button in the Rules Window.
Screen clipping taken: 4/29/2009, 4:59 PM
Name this rule Set File Name and click on the Set Condition… button. For the Condition check if the submitFormName is blank. Click the OK button.
Click the Add Action… button. For the action select Set a field’s value, for the Field select submitFormName, for the Value use, using the fx builder use the expression concat(“Account Request – “, now()) then click OK.
Click OK on the Rule Window. Now click on the Add… button again on the Rules window. Name this rule Submit Form and do not specify a condition. Add an action to Submit using a data connection and select the Data connection created in the last section.
Click the OK button on the Action and Rule windows.
Click the Add… button on the Rule Window. Name this rule Close Form and do not specify a condition. Add an action to close the form.
Click Ok on all of the windows until you are back to the InfoPath form designer.
Now publish your form to the SharePoint site library that was specified in the Data Connection section. Once the form is published go to that library and choose Settings->Form Library Settings
Under the General Settings choose Advanced settings
In Advanced Settings under the Browser-enabled Documents choose Display as a Web page and then click OK
This will force the InfoPath form to be opened using Form Services.
Now complete a form and submit it. Then click on the form, change a value and submit again. You should see your changes applied after you submit.