Previous Topic: How to Link Fields in Two Forms for Simultaneous UpdatesNext Topic: Attach a Form to a Service Option Group


Use the Script Dialog to Maintain Custom JavaScript Functions

The Script dialog for each form lets you create and maintain JavaScript functions that apply to a form. Using the Script dialog is the best-practice option for maintaining custom JavaScript functions for a form. The functions that you save in the dialog apply only to the form that you are editing. To use the Script dialog for a form, you require access rights to edit the form.

Follow these steps:

  1. Click the name of the form in the Form Designer tree.

    The form attributes appear, and the Script button activates. The Script button appears on the toolbar with the Localize, Save, Restore, and other buttons.

  2. Click the Script button.

    The Script dialog appears and displays the custom JavaScript functions already specified for the form, if any. You can enter new JavaScript functions before or after any existing ones.

    Note: To view a template for a function, click Show Help on the Script dialog. The template shows the product-specific implementation of a standard JavaScript function.

  3. Write and save the custom function. Use the format shown in the sample functions that appear when you click Show Help on the Script dialog. This format is known as JavaScript object literal notation.
  4. Save the form.
  5. Specify the name of the function in the JavaScript attribute from which you want to call it. Use the following format:
    ca_fd.js.function-name
    

    An example follows:

    ca_fd.js.calculateCostQty()
    

    Typically, you specify a custom JavaScript function in one of the following:

You have used the Script dialog to maintain JavaScript functions that apply to a form.