This documentation is archived and is not being maintained.

scripts Element

Office 2007

Defines the source of all business logic scripts used at the document level in the form.




language(Required attribute) Defines the script language used in the business logic source files.
script(Optional element) Defines the source scripting file containing all the data-level script content referenced in the form.
enforceScriptTimeout(Optional element) Specifies whether to enable or disable a time-out period for scripts.


The scripts element is an optional element of the xDocumentClass element.

There can potentially be more than one script element in the scripts element; however, they should all be written in the same scripting language. All defined script sources are concatenated and loaded into a single script engine environment when the form is being filled out. This means that duplicate functions and property names are resolved by default by the script engine, and the last declaration is the one that is used. Form developers must ensure unique names across scripting source files that are used in a form.

In order to add encoded jscript files to a form, you need to edit the form definition file (.xsf) to change the language property in the scripts element. After the property has been updated, the scripts section in the .xsf file will look like the following:

<xsf:scripts language="jscript.encode">
	<xsf:script src="scriptenc.js"></xsf:script>

The scripts element is not present in the .xsf file if the form uses managed code.

Note   If this element or attribute is in the form definition file (.xsf), InfoPath Forms Services will prevent the form template from being deployed to the server as a browser-compatible form.


The following is an example of the scripts element:

<xsf:scripts language="jscript" enforceScriptTimeout="no">  
  <xsf:script src="internal.js" /> 
  <xsf:script src="script.js" />