Is there any way to determine which button was clicked in the FormEvents_Submit event on Infopath 2010? I have a number of buttons on my form, each with a slightly different submission routine. I did simply have a separate code action for each button, but this caused issues with wanting to close the form after submission. It appears that I can solve my problems if I use a submit action on the the buttons, and set the submit options to use custom code. But for this to work, I will need to know what button was clicked. I thought I would be able to use the generic sender object passed to the event handler - I expected to be able to cast this as an XPathNavigator and get it's name, however it is coming through as a Microsoft.Office.InfoPath.Internal.XmlFormHost object.
If I try and get the button itself to set a field via a rule or code so I can check it in the submit code it doesn't work as I am no longer calling the generic submit action.
Is there any way to get the code working, or an alternative I haven't thought of? This will be running as a browser form, if that makes any difference.