Notification on Save to Host? Forms Services - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Notification on Save to Host? Forms Services

Last post 05-30-2012 05:16 AM by sunithasr. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 12-27-2007 08:37 AM

    Notification on Save to Host? Forms Services

    Hello all: Over the past few months I have been doing quite a bit with InfoPath 2007 and Forms Services. We have started putting together a fairly complicated application, using many of the features of InfoPath and Forms Services, web service connections, resource files, managed code in the form where applicable, submitToHost, notifyHost, switching views in the initialize event of the XmlFormViewer, custom web part connections, etc.

    However, I'm facing an issue I can't find an answer to. Does anyone know if its possible to somehow use NotifyHost for example, or another method to trap or be notified of a SAVE event?

     I am NOT talking about submit, or submit connections or rules. I mean, using the InfoPath Forms Services the save button is pressed to save the form to a forms library/MOSS site. I realize you can not have custom code for the save event if using Forms Services, but I'm trying to find a way to notified or trap that the save has occured. I don't even need to cancel it or intercept the event, I basically just need a pre or post save notification so in my code behind I can do some dynamic activity. My other idea, which I loathe unfortunately, is to remove the ability to use the built in Save button and create my own button, which basically does a submit behind the scenes, using a library connection.

    The current submit process is already through a custom button/our own events, and I don't want to remove the user's ability to name the form themselves (if I use another custom button for saving, I will be auto-generating the name for the library connection, etc).

    Any ideas on getting a save notification from InfoPath Forms Services?



  • 01-28-2008 12:29 PM In reply to

    Re: Notification on Save to Host? Forms Services

    Maybe I am exposing my ignorance here, but why wouldn't the OnSave event work?

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-28-2008 03:30 PM In reply to

    Re: Notification on Save to Host? Forms Services

    Yup, ignorance exposed.  I am working with InfoPath Forms Services, managed code and InfoPath 2007 within a MOSS Environment. There is no custom action or custom "save" event allowed for Forms Services.  I believe you are mixing  up context here/don't understand what I was trying to do/fix. In fact, using the C# or VSTO object model, you don't even get access to the OnSave event, I believe you are referencing the script model and functionalty dependant on the rich client or using Infopath at the client desktop.

    I got around this problem but ditching the default InfoPath Forms Services toolbar and creating my own buttons.  I am now doing basically submits, but I can use the "SubmitToHost" method and the XmlFormViewer to do some custom server side actions after the submit event occurs.  Now we have a "vanilla" submit, and other "action" buttons which do a submit but additional logic as well, etc.




  • 01-28-2008 03:41 PM In reply to

    Re: Notification on Save to Host? Forms Services

    You're mentioning XmlFormViewer so I am assuming you're hosting Forms Server in your own ASPX page. While I am not aware of any official blessed way of getting notified on save there is one thing you can try. The "save" button is nothing but an Anchor tag with an onclick event. Since you can run javascript in your ASPX, try to chain the onclick event by replacing it with your own handler and then calling the original one. Heck, you don't even need to be subtle, just blow it away and replace it with your own handler, just make sure to call Toolbar.ExecuteAction('saveAs', event) afterwards.

    Now in your handler you're totally home free on what you do. For example, you can modify some field in your page so that you get a notification on postback, it's just "party on".

    I hope this helps somewhat...

    Disclaimer: I didn't try any of this and hacking the Forms Server browser-side events is not officially supported.


    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-28-2008 04:42 PM In reply to

    Re: Notification on Save to Host? Forms Services

    Yes, this approach "kind of" works in theory, since I started this but decided different approach.  At the end of the day, we could get away with a save really being a Moss Library submit, the nomenclature to the end user doesn't really matter, I have all custom buttons on the form, again, completely removing the InfoPath Forms Services toolbar.  This application has a lot of moving parts and I found that by using the NotifyHost and SubmitToHost methods server side, I got a ton of flexibilty and all supported by Microsoft (a win-win, since I've been burned by the javascript hacks in the past :) ).  Basically the "save" button does a submit, over-writing the existing document, we still have the version history of the form and in this system there is a full business process, set of workflows and other rules which run and also are smart enough to know which button has been pressed.  Other buttons on the form such as "Move Forward" and "Go Back" set statuses and kick off work flows, etc.  Save, simply submits the form, without doing the "extra" true "submit" logic which occurs when the end user clicks a different custom button, etc.

     Thanks for the feedback. I actually wound up extending the XmlFormViewer as well, since our application is more of a hybrid.


  • 05-30-2012 05:16 AM In reply to

    Re: Notification on Save to Host? Forms Services


    Is there a way to trigger a javascript code to be executed from the custom aspx page (xmlformview) without having any buttons for save or submitting the form in infopath form.

    In the custom aspx page we will just load the infopath form and then we want to trigger a javascript code to be executed to get the form validated and form values and send it to another workflow application.

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