Document JavaScript

The JavaScript tab in document properties allow you to view and edit a document's JavaScript actions. These are actions that occur at the document level based on certain events. These events can be on open, close, before saving, after saving, before printing, and after printing. Actions can be added, edited, or deleted using the options in this tab.

 

How to View/Edit the Document JavaScript Actions

  1. Go to File Tab > Properties or using the shortcut keys Ctrl + D (⌘ + D on Mac).
  2. Click on the JavaScript Tab
  3. The current actions will be displayed in the dialog. Use the Add, Edit, or Remove options to modify the JavaScript actions if needed
  4. Click OK to apply the changes
  5. Save the document to save the new Document JavaScript settings

Options

Add - Opens the action dialog to add an action to the document

Edit - Edits the currently selected action from the list

Remove -  Removes the currently selected action from the list

 

Document Actions

Document actions define JavaScript actions to be performed following a predefined event. 

Event

Open: Open actions will be triggered when the document is opened

Close: Close actions will be triggered when the document is closed

Before Save: Before save actions will be triggered when the document is saved but before the file on the system is actually updated. For example, if you wanted to update a date value with the exact time saved

After Save: After save actions will be triggered once the file has been saved

Before Print: Before print actions will be triggered when the document is printed but before the file is actually sent to the printer. For example, if you wanted to update a date value with the exact time printed

After Print: After print actions will be triggered after the document is printed

JavaScript Action

Sets the Action to perform a custom Supported JavaScript action that can be typed into the field. Type the JavaScript you wish to be used into the text box.

 

Named JavaScript

Named JavaScript is used to define functions that can be referenced by other JavaScript calls within the document. These can be referenced when the document is opened or at any other point in time needed. This is useful when you have a common function that needs to be performed on different triggers and actions across the document and helps limit writing duplicate JavaScript code. 

Name

Use the name field to define the name to be used when referencing this specific action in the future

JavaScript Action

Type the JavaScript functions you wish to be used into the text box. Sets the Action to perform a custom Supported JavaScript action that can be typed into the field.