the code does not define an OnSaveRequest event handler - InfoPath Dev
in

InfoPath Dev

the code does not define an OnSaveRequest event handler

Last post 09-03-2009 08:44 AM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-01-2009 09:41 AM

    the code does not define an OnSaveRequest event handler

    I'm a newbie to InfoPath and am trying to write a custom Save event handler.

    I went to Tools, Form Options, Open and Save, checked "Save using custom
    code" and clicked the Edit button.

    The VSTA IDE opened and a template FormEvents_Save method is there. In the
    InternalStartup() code, there's a line to add this event handler to
    EventManager.FormEvents.Save.

    I wrote my custom code and saved it. I saved the form template.

    When I attempt to fill out a form based on this template, I get the
    following error when I try to save the form:

    "Microsoft Office InfoPath"
    "InfoPath cannot save the form.
    The form definition (.xsf) file specifies that save functionality will be
    defined in code, but the code does not define an OnSaveRequest event handler."

    Should I be writing my own OnSaveRequest handler? If so, how? Why doesn't the IDE automatically create that method instead of creating FormEvents_Save() for me?

  • 09-03-2009 08:44 AM In reply to

    Re: the code does not define an OnSaveRequest event handler

    Something doesn't sound right about that scenario... The InfoPath 2003 OM uses OnSaveRequest, while the InfoPath 2007 OM uses FormEvents_Save

    I followed the same basic instructions:

    1. Create a new blank form.
    2. Select Oepn and Save in Form Options
    3. Select the custom coded check box and click Edit
    4. In the generated code file I added the code MessageBox.Show("Hi"); and saved.
    5. I previewed the form and pressed CTRL+S
    6. My "Hi" dialog appeared, and after that the Save dialog.

    Try with a new blank form and see if you get the same results.

    Are you using a different machine, a different InfoPath to fill out the form than you are for creating the form?

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.