The InfoPath Form Web Part is pretty handy, but its options for behavior upon submitting are less than ideal. The only options available are leaving the form open, closing it, or opening a new one. Luckily, InfoPath Designer 2010 offers a fairly painless solution. Let’s start with a basic form.
This is going to be our default view, but we’ll need two more to handle the submit and cancel actions. Select the Page Design tab on the ribbon and click New View. Name the new view “Submit,” and add some kind of message to the blank page that has appeared.
Next, create another view named “Cancel” and add an appropriate message there.
Now we need to create a few rules to display these views when appropriate. Navigate back to your default view using the View dropdown menu on the Page Design tab and click your submit button. On the Home tab, click Manage Rules. Add a new action rule with the type Switch views. Select “Submit” from the view list and click OK. Add a similar rule for your cancel button.
Before you publish the form, you’ll need to take a look at the Submit Options from the File tab. Make sure that After submit is set to “Leave the form open.”
Finally, publish the form, add it to your InfoPath Form Web Part, and change the Submit Behavior setting for the web part to “Leave the form open.” Now, your form will display your custom message instead of something confusing like this:
Of course, you could also use this for more complex scenarios, like creating multi-page forms. If you added conditions to your buttons’ rules, you could even display context-dependent views, displaying different forms based on data the user entered on the default page.