Close button - InfoPath Dev
in

InfoPath Dev

Close button

Last post 01-02-2010 01:00 PM by parajuli_95. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-15-2009 11:52 AM

    Close button

    Hi All,

    I am new in infopath, and i need to add a "close" button in the inforpath form which is publish in web. So if user click in the close button then from should be closed.

    I have of course tried rule => close this form but it just refresh but don't close in browser. (in infopath it does work).

    I search in google and i can see many comments code in Vb script, C#, VB, JScript and so on but i am not able to fix the code which i found.

    I am using "Visual Studio 2005 Tools for Applications" to view code, can some one help me what is the code behind the button?

     

  • 12-18-2009 09:37 PM In reply to

    What version of InfoPath are you using? You can add a rule to InfoPath 2007 with custom actions that close the form on submit. No code required.

    You can also add code to the form that does this and call that from a button using the XdExtension:: xpath prefix.

    Patrick Halstead
    Project Manager at Qdabra
  • 12-19-2009 02:26 PM In reply to

    Hello,

    I have found that the following way works well to close a browser based form with button click. In the button click event you can use the following code:

    public void btnClose_Clicked(object sender, ClickedEventArgs e)
    {
      string closeWindowPath = "/_layouts/windowclose.htm"
    ;
      // Redirect to close the form
      HttpContext.Current.Response.Redirect(closeWindowPath, false
    );
    }

    Besides this you need a second file ("windowclose.htm") which you can put wherever you want --- I prefer the "/_layouts"-Folder but you can choose another location as well.
    In this file you have to write the following HTML/Javascript code:

    <html>
    <head>
    <script type="text/javascript" language="JavaScript">
        self.close();
    </script>
    </head>
    </html>

    Now if you press the "close" button you will be asked if you want to close the browser.

    Hope that helps.

    Regards,

    Karsten
    Filed under:
  • 01-02-2010 01:00 PM In reply to

    Thank you for comments - i will try it and let you know if it works.

    happy new year.

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