The Script Editor
The Script Editor is the tool you use to create and edit scripts. You can view the Script Editor in either single or multiline view. Unless you are creating one-line scripts in FormCalc, you should use the multiline view. The multiline view provides a number of features that the single-line view does not. To switch between the multiline view and the single-line view, click and drag the Script Editor palette bar until the palette is the required size (Figure 4.3).
Figure 4.3 Click and drag the Script Editor palette bar to switch from single to multiline view. If you single click on the palette bar, the Script Editor toggles open and closed.
If you cannot see the Script Editor on your screen, select Window > Script Editor.
The Script Editor in Single-line View
Figure 4.4 shows the Script Editor in single-line view. Notice how small the script editing window is. Even my very short script was truncated. This example shows the Print button from the Contact Information form.
Figure 4.4 The Script Editor in single-line view.
The Script Editor shows the following information in both single and multiline view:
- Event: In this case the event is the button's click event. The asterisk indicates that there is script in this event. If you select the event drop-down menu, you will see all of the events for this object. Grayed out events are not available for this form object.
- Script editing window: This is where you write and edit your scripts.
- Enter/Cancel a script source change: These buttons commit or cancel your script source changes to your XML source. If you do not commit your script changes with this button, they may not execute properly when you select Preview PDF. These buttons were removed in Designer ES.
The Script Editor in Multiline View
Figure 4.5 The Script Editor in multiline mode provides additional options.
- Show events for child objects: This feature is a welcomed improvement in LiveCycle Designer 8. You can now see all of the scripts for a subform, a page, or for your entire form at once. Prior to the addition of this feature, it was very difficult to find all of the scripts that were hidden in different parts of a complex form. This option shows all of the scripts for the currently selected object and all of its child objects. If you select the top form object in the hierarchy, this option displays all of the scripts associated with a specific event. Alternatively, you can change from a specific event to view all events by selecting Events with Scripts to see every script in your form.
Run At specification: This option specifies where your script will run. The Run At specification in Figure 4.5 is Client, which means the script will be processed by Acrobat, Adobe Reader, or a Web browser. If the specification is set to Server, the script is processed by LiveCycle Forms. If LiveCycle Forms is not part of your system, you should always use the Run At Client option. The third Run At option is Client and Server. Use this setting when you are not sure if your form will be rendered on a client or a server, or for forms that may be rendered on both the client and the server at different times. For instance, if your form will be used as a self-contained PDF file and as an XDP file that will be processed by LiveCycle Forms into an HTML form, use the Client and Server setting for your scripts.
You can choose this option when you want the server to recalculate and/or revalidate submissions that were first calculated in the client application. You can also use this option when you are creating HTML forms with the LiveCycle Forms product. If you have a script that cannot function in the HTML client environment, it will be passed back to the server for processing if the Run At specification is set to Client and Server.
The Check Script Syntax tool in Designer ES
Figure 4.6 The Check Script Syntax tool is included in the Script Editor of Designer ES.