Locating JavaScript in applications
JavaScript can be inserted into various locations within a Domino application, and that flexibility is both a boon and a problem. Follow-on developers may have to go hunting to find an errant function.
JavaScript can be placed on forms or pages in many locations, including these:
A JavaScript library
The HTML Head Content area
The JS Header
A Web event, like onClick
Inline as Pass-Thru HTML
Inline attached to an HTML tag as Pass-Thru HTML
A separate page or subform
Form fields (forms only)
Computed text
Place functions in JavaScript libraries
Unless there is a very good reason not to do so, JavaScript functions should be co-located in one or more JavaScript libraries. Scripts in a library can be shared by all forms and pages in the application, and co-location makes it easier to find functions for maintenance. Function calls, of course, exist in other places.
Create a JavaScript library with Designer. Open Script Libraries as in the following screenshot.
Note
Different...