When Migrating InfoPath 2003 or 2007 Forms, Watch out For Legacy JScript

JScript is a JavaScript variant used both by Microsoft browsers (e.g. Internet Explorer) and active scripting engines such as the Macro development engine within Office.  It was originally developed back in 1996 as part of Internet Explorer 3.0 to compete and co-opt JavaScript which was originally part of Netscape, the dominant web browser at the time.  Microsoft also has VB Script which is the default scripting language found in Office products for developing macros.

When migrating InfoPath 2003 or 2007 forms from previous versions, the original developer could have included some JScript code in the form.  This code responds to various events such as the form loading, clicking on buttons, changes to the form, etc.  If you try to load this form in the “latest” (InfoPath stopped being latest in 2013 when Microsoft stopped development on it), you will see this message if you look at the code:

image

Any JScript that was embedded into the form won’t run and isn’t compatible with InfoPath 2013 – Microsoft dropped support for JScript in 2010.  You cannot even open the code to view it – the only option you have is to remove it.

If you want to keep this code, you’ll have to port it to C# by opening the form in a previous version of InfoPath (e.g. 2003 or 2007), scraping out the original JScript code and re-writing it as C# code.