Previous Topic: The requires AttributeNext Topic: Javascript Global Statements


Javascript Validation

The first step is to ensure that the iConsole in-built Javascript validation is applied. This validation cannot guarantee the complete compatibility of your Javascript with the Release 12.5 iConsole, but it is essential to pass this stage before proceeding further.

The validation is switched on by setting the following registry Key Value to "true" on the client computer used to install the reports XML files. For example:

[HKEY_LOCAL_MACHINE\SOFTWARE\ComputerAssociates\CA DataMinder
    \CurrentVersion\WebService]
"ValidateSearchJavascript"="true"

A basic validation process is applied by the iConsole when installing any reports XML file. To ensure this validation is applied to your customized reports, you must reinstall the reports XML.

If any errors or warnings are reported while installing an XML file, review and correct these before proceeding. For example, you must explicitly declare undeclared variables. Although these may seem trivial, they can cause errors later if a variable has the same name as an HTML element.

The following shows an example of an undeclared variable.

function setRollupOrder()
{
sRollupOrder = document.getElementById('sRollupOrder')
sRollupOrder.value = str;
}

This is the iConsole validation warning message:

The search definition javascript has errors.     
    JS1135:Warning-Variable 'sRollupOrder' has not been declared Line 36, position 8.
   sRollupOrder = document.getElementById('sRollupOrder')

In the function above, and depending on the browser used, the variable sRollupOrder may be implicitly defined as a global variable, which then clashes with the same name used for an HTML element. The function must define the variable explicitly to avoid this:

function setRollupOrder()
{
       var sRollupOrder = document.getElementById('sRollupOrder')
       sRollupOrder.value = str;
}