scripts Element

Microsoft Office InfoPath

Show All Show All

scripts Element

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

Type

      xsd:complexType
    

Structure

Name Description
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.

Remarks

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>
</xsf:scripts>

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

Example

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" /> 
</xsf:scripts>