There are several pre-defined JavaScript exits which are described on subsequent pages in this guide. In addition, you can create your own JavaScript methods which you can attach and call to any of the fields on the form, using a JavaScript event to trigger the entry to your own method.
There are two steps to creating your own JavaScript method. First, you create a link from the field on the form to your JavaScript method. Secondly, you create the JavaScript method within the UserJavaScript.js file on the server.
-
Within the layout editor of ExtraView, select the field that you wish to use to trigger the user-defined JavaScript function, and create a layout element attribute of type HTML Modifier. For example, an HTML modifier can be created similar to –
onchange=user_fn(paramList);
This will call the function in the JavaScript file named user_fn on the server for operations such as validation, or altering the required or visibility attribute of fields. You can use any other JavaScript event such as onclick, onfocus, onkeyup, or onmouseover to trigger the call to the JavaScript.
-
You may place any valid JavaScript methods within the UserJavaScript.js file. This allows each user-defined JavaScript method to be executed from any field that references the method by name. Example JavaScript function –
function validateUPS(val) { alert("Value passed is: " + val[val.selectedIndex].text); return; }