To create a calculation or script

  1. Select an object on your form design that supports events. For example, add a button to a new, blank form.

  2. In the Script Editor, from the Show list, select one of the events that apply to the object. The event you choose specifies when the script will execute. If you are writing a calculation or script that affects an object that does not support events, you must add your calculation or script to a form design object that does support form events. For example, using the new button object, select the click event in the Show list.

  3. In the Language list, select your scripting language. For example, for the new button object, select JavaScript.

  4. In the Run At list, select where you want the script to execute. For example, for the new button object, select Client.

    You can choose to run calculations or scripts on your client-based application (for example Acrobat or a web browser) or on your server-based process.

    When set to Client, processing of calculations and scripts initiates after the form renders. When set to Server, processing of calculations and scripts initiates during the form rendering process. Previewing your form by using the Preview PDF tab simulates opening the form in Acrobat; therefore, scripts set to run at Client or Client and Server execute.

    Note: Selecting Client And Server from the Run At list causes a script to execute in either the client application or the server application, depending on which application is used to process the form.
  5. In the Script Source field, insert your FormCalc calculation or JavaScript script. You can take advantage of the statement completion functionality of Designer to help you create reference syntaxes for your calculation or script. For example, add the following JavaScript script to the new button object:

        xfa.host.messageBox("Hello World!", "Creating a new script", 3);

  6. After you complete your form design, test and debug your calculations and scripts before putting them into production. For example, for the new button object, preview the PDF of the form using the Preview PDF tab. Click the button object to display the message box specified in step 5.

    For more information about the Designer objects that support scripting, see Objects that support calculations and scripts.

// Ethnio survey code removed