Not sure if anyone else has used K2 extensively on this forum. Luckily I have.
I found this to be an issue as well. It sounds like you have some of your own custom code, so K2 forced you down the path of using a custom task pane to submit. Correct?
This is what we did. On the K2 server there is a directory called C:\Program Files\K2.net 2003\Bin\Temp\IPResourceFiles. In that directory there are the files that K2 shoves into InfoPath, specifically the k2 custom task pane (taskpane_new.htm). If you jump into the code, you will see there is a submit to thier webservice. What we did was place methods around that submit call that have to be implemented on the InfoPath form. We did something like:
if (window.external.Window.XDocument.Extension.CanSubmit()) {
window.external.Window.XDocument.Extension.BeforeSubmit();
gobjXDocument.Submit();
window.external.Window.XDocument.Extension.AfterSubmit();
}
Once you make this change, you will need to refresh your InfoPath form with the K2 process by right clicking the process. Now you will need to implement these methods on EVERY InfoPath form that is exported to that server.
Now all you need to do is call your validation fuction inside of CanSubmit() inside of InfoPath.
The nice thing about doing this is that all of your forms will have a consistent approach to handling the K2 submission. So if you have future forms that may not the same type of validation model, you can simply just return true and you are done.
I did not use the OnSubmitRequest() but I think moving the code to this new method should do the trick. Hope this helps.
Isn't K2 GREAT tool. I have loved working with it thus far.
Jason
http://www.k2distillery.com/