0
votes

I'm designing an InfoPath form that will be saved to a SharePoint 2010 library. This will occur automatically when the user performs a certain action on the form. If the user closes the form, it should prompt them to save changes and if necessary, save to SharePoint.

Problem is I don't want the users to have control over where the form is saved or what it's called, as I intend to handle that automatically.

Now it's possible to capture the onSave event and perform a custom action. But if I did this, I'd need to set the property to cancel the save event, or the user will be shown the "save file" dialog box anyway. But cancelling the save event causes InfoPath to display a warning to the user - "InfoPath cannot save the form. The OnSaveRequest event handler returned a value indicating that the save failed".

Is there any way to facilitate custom save events while still allowing the user to use the save button? It's also important that the user is promted to save changes if they try to close the form, however disabling the save option removes that prompt.

1

1 Answers

0
votes

I worked out what to do. The solution is much simpler than I thought.

Capture the onSave event, perform the custom save action, set the cancel flag to false, and remove the call to PerformSaveOperation(). This eliminates the mentioned error message, and doesn't prevent the user from closing the form.