Onsubmit event handler did not work - InfoPath Dev
in

InfoPath Dev

Onsubmit event handler did not work

Last post 07-19-2011 08:02 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-19-2011 06:59 AM

    • Shyam23
    • Not Ranked
      Male
    • Joined on 06-10-2011
    • Atlanta
    • Posts 19

    Onsubmit event handler did not work

    Hi,

    I have published several infopath forms as content types and saved the workspace as a template. Users will create many workspaces based on my template. I need the url of the workspace when the form is opening. If I use, substring-before(substring-after(processing-instruction()[local-name(.) = "mso-infoPathSolution"], 'href="'), '"'), it gives me the url of the content type. I used the code as per this blog: http://blogs.msdn.com/b/infopath/archive/2006/11/08/submitting-to-this-document-library.aspx?PageIndex=10&CommentPosted=true#commentmessage. Now I get an error.

    "Infopath cannot submit the form The onsubmit event handler did not work

    The given key was not present in the dictionary.
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at Microsoft.Office.InfoPath.Internal.DataConnectionsHost.get_Item(String name)
       at Stakeholder_checklist_final.aspx.FormCode.FormEvents_Submit(Object sender, SubmitEventArgs e)
       at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnSubmit(DocReturnEvent pEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSubmitRequest(DocReturnEvent pEvent) "

    I have security as "full trust" only, but still I get this error. Can anyone guide where I am going wrong ?

    Thanks,

    Shyam

  • 07-19-2011 08:02 AM In reply to

    Re: Onsubmit event handler did not work

    It looks like your OnSubmit event handler is throwing an exception.  It looks like your code is trying to access a data connection that doesn't exist.  Do you have code like that?

     Edit: Looking at the code from that blog, there is a line that accesses a data connection called "Main submit". Do you have a data connection called "Main submit"?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.