OnSubmitEvent

M

morna

I have an Infopath 2007 form that is published within the MOSS 2007
environment. I have a submit button on the page. I want the submit
button to:
1. run my custom code on the OnSubmit event and
2. same the form to a sharePoint form library.

For working with the properties of the Submit button - I can only do
one of those things. Either set the button to save the form into a
sharepoint form library OR do the custom code. Is there a way I can
do both?
Please help.

Thanks for your time.
 
M

morna

Here is the answer. Add this to your custom code handler - the
OnSubmitEvent(...) after you have performed all your custom code.

// Get a reference to the submit data connection
FileSubmitConnection fc =
(FileSubmitConnection)DataConnections["POFormLibrary"];

// If the submit operation is successful, set
// Execute the submit connection
try
{
fc.Execute();
e.CancelableArgs.Cancel = false;
}
catch (Exception exp)
{
e.CancelableArgs.Cancel = true;
}

You have to create a dataconnection to the location you want to submit
the form to first. In my case I called this data connection:
POFormLibrary. It works for me. I set the Submit button properties to
"run custom code".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top