Include Statement in Javascript - InfoPath Dev
in

InfoPath Dev

Include Statement in Javascript

Last post 08-22-2011 11:21 PM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-22-2011 06:30 AM

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Include Statement in Javascript

    Hi,

     Is there a way to have an include statement like in C (#include <otherscript.c>) in the script of a form template?

    The reason for wanting this is that there are global variables defined that are used for several forms and they may require frequent change..

    Erich

  • 08-22-2011 08:13 AM In reply to

    Re: Include Statement in Javascript

    I have looked into this in the past, but to the best of my knowledge there isn't a way to do this.  Might I suggest putting these values in some centralized location (e.g. a SharePoint list, webservice, or XML file secondary data source - the first two would be better than the third), where you can easily manage and change these values?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-22-2011 09:09 AM In reply to

    • Erich
    • Not Ranked
    • Joined on 07-27-2011
    • Posts 11

    Re: Include Statement in Javascript

    Jimmy, thanks for the quick reply but I forgot to mention, in addition to the variables there are also several functions that are used in all the forms, which would also be nice to manage centrally..

  • 08-22-2011 11:21 PM In reply to

    Re: Include Statement in Javascript

    Well, to the best of my knowledge this is not doable with JScript.  I would suggest pursuing either (a) Using a web service to provide this functionality if it's something like performing calculations, or (b) Looking into using managed code (C# or VB.NET), which will allow you to have multiple code files in your solution, including a common one that's chared between forms.  You could even create a compiled DLL with all the constants and functions that you need, and share that between your forms.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.