Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

Carl

share|improve this question

1 Answer 1

Why dont you create a field with the name of the button that was clicked eg- ClickedButtonName, then use the "Set a fields value" rule to the name of the button. This way you can avoid using "Custom Code" and it will still work if you do use Custom code because you can just query the value of the field with the XPathNavigator...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.