Using this.close() after submit - InfoPath Dev
in

InfoPath Dev

Using this.close() after submit

Last post 03-27-2013 02:14 AM by HHearle. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-26-2012 10:59 AM

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Using this.close() after submit

    I am using IP 2007. Forms opens on client machine. I am using one button to do multiple things:

    1) switch to another view (using rules), then

    2) print the form (in code behind (this.print())),

    3) submit the form (this.submit())

    4) close the form(this.close()).

    The problem is the form closes, but Infopath (the application) stays open and presents the "Getting Started" window to boot.  This will confuse my users.  How can I, through code, close the form AND the application?

  • 11-26-2012 01:30 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: Using this.close() after submit

    I found a solution. 

    Replace this code: this.Close(): with this code: this.Application.ActiveWindow.Close(); and place it in a try/catch/finally to catch NullReferenceException.

  • 03-27-2013 02:14 AM In reply to

    Re: Using this.close() after submit

    Why not try sendkeys?

    var WshShell = new ActiveXObject("WScript.Shell");  

    WshShell.SendKeys("%fx")

     Since code alway runs after rules?  This would close the whole program (but I think this is only Javascript- I presume this is what you are using) :p

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