User-defined JavaScript functions can be attached to individual fields on each add or edit screen within ExtraView. The JavaScript functions are not restricted in scope. This powerful feature allows you to generate virtually any functionality within an add or edit screen. Some typical uses of this feature are:
- Generate simple or complex data checking functions that are triggered upon selecting or editing an individual field
- The functions can refer to multiple fields on the form, thus allowing you to check for specific combinations of data. E.g. you may want to check the value of a field entered, according to the specific Product selected, one of two Statuses selected, and the Assigned To for the issue
- Alter the requiredness of a field or fields
- Alter the visibility of a field or fields
- Provide mathematical computation between fields on a form, within the browser and without using a business rule executed on the server
- Override the inbuilt ExtraView JavaScript functions
To accomplish the setting up of a user-defined JavaScript function, first note that each ExtraView form generated for most screens contains the following statement:
<SCRIPT LANGUAGE="JavaScript" SRC="xxxxxxx/user_javascript/UserJavaScript.js"> </SCRIPT>
where xxxxxxx is the environment name. This permits the programmer to reference JavaScript functions within the ExtraView environment.
There are occasions when you might want to include an entire existing JavaScript source library, file or source tree. This is achieved with the use of the behavior setting named USER_CUSTOM_JAVASCRIPT. Put the path name of the files you want to load into the value of this setting. The path is relative to the directory named javascript within your ExtraView environment. Separate multiple files with a semi-colon character.
No checking is done for the presence of this file, so be careful to make sure your JavaScript file exists at the location you provide.