Close event in InfoPath 2007??? - InfoPath Dev
in

InfoPath Dev

Close event in InfoPath 2007???

Last post 03-20-2013 08:36 AM by Bo Clarence Shizzle III. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-12-2008 09:50 PM

    • arduk
    • Not Ranked
    • Joined on 11-28-2007
    • Posts 10

    Close event in InfoPath 2007???

    I'm sorry if this is a really simple question, but I can't seem to find how to implement an onclose event for an Infopath client form.

    I would expect this would be fired if a user closed the form (or the infopath client)?

    My problem is that I want to prompt users to save if the form is dirty and they exit Infopath (eg by using File->exit infopath, or by using the close X button at the top right of the infopath window)

    Any help on this greatly appreciated.

    Thanks in advance!

  • 08-19-2008 06:48 AM In reply to

    Re: Close event in InfoPath 2007???

    You can more precisely control the close event by defining a Rule on a Button.

    Add the Action "Close the Form" and tick the Checkbox saying "If changes have not been saved, prompt the user to save".This will ask the user if any changes done in the form.

    Thanks & Regards,
    Srikrushna Patro.
  • 08-19-2008 03:03 PM In reply to

    • arduk
    • Not Ranked
    • Joined on 11-28-2007
    • Posts 10

    Re: Close event in InfoPath 2007???

    Thanks for getting back to me.

    I am aware that you can control this with a button, however even if you put a button on, this doesn't stop a user from using the Close button at the top right of the window instead of the button, which will then cause them to lose all of their data without being prompted to Save.

    Can anyone confirm that there is no close event on a form? Or am have I been looking in the wrong place?

    Thanks in advance!!

  • 01-27-2011 05:52 AM In reply to

    Re: Close event in InfoPath 2007???

    I too have the same concern, where is the close event in InfoPath 2007 so I can force the user to save.

    did anybody find a solution to his yet?   I made a solution:

    1) Use windows API to disable the form close button...    http://social.msdn.microsoft.com/Forums/en/sharepointinfopath/thread/257f186f-3ab3-4ac4-9553-f71d100ad297
    2) Disable the toolbars using code from google..
    3) put a button on the form for the user to close the app
    4)  use Application.Exit() to quit InfoPath.

    public void btnExit_Clicked(object sender, ClickedEventArgs e){
    // your save code here.

    //re-enable toolbars before you exit
    HideAllToolbars(
    true);
    //Exit App
    Application.Quit();
    }

    void HideAllToolbars(bool flag)

    {


    CommandBars myCommandBars = this.Application.ActiveWindow.CommandBars as CommandBars;

    CommandBar myCommandBar = (this.Application.ActiveWindow.CommandBars as CommandBars).ActiveMenuBar;

    foreach (CommandBar item in myCommandBars)

    {

    //MessageBox.Show(item.Name.ToString() + " " + item.Type.ToString() + " " + item.Index.ToString());

    if (flag == true && (item.Type == MsoBarType.msoBarTypeMenuBar || item.Type == MsoBarType.msoBarTypeNormal))

    {

    item.Enabled =
    false;

    }

    }

    }

  • 03-20-2013 08:36 AM In reply to

    Re: Close event in InfoPath 2007???

    I have this same concern.  I want users to be prompted if they've entered data / changed the form if they want to save their changes when they click any close button. Whether it's a button in the form or on InfoPath. 

    Also, I have a close button in my form with the "Close the Form" action running when it's clicked, and I have the checkbox saying "If changes have not been saved, prompt the user to save" ticked, however that prompt is not showing up when users click the close button.

    Any Ideas?  The ideal solution would be a simple close button in the form that does just that but prompts users to save if they've entered any data/changed any data on an opened form.  And the same behavior if using the close button on Infopath.

    Update: I had removed the ability to Submit the form under Tools > Submit Options and unchecked the "Allow users to submit this form" check box.  To minimize confusion, we wanted a button labeled "save" in the form itself that would submit new forms to the SharePoint library as well as save over/update any changes to forms already in the library.  When unchecking "allow users to submit the form" it removes the Prompt users if they want to save changes functionality even if the close button has the "If changes have not been saved, prompt the user to save" check box ticked in the "close the form" action.
    This is just an update. It doesn't resolve the issue.

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