doLoad

On all the key ExtraView screens, such as the add screen, the edit screen and the query screen, there is a standard JavaScript call in the ONLOAD attribute of the BODY tag within the HTML page. This call is to a method with the following signature:

doLoad(document.editForm)

The doLoad method initializes several required elements of the form. In addition, this method calls a function within the UserJavaScript.js file. This method has the following signature:

 

function userJavaScriptOnload(displayMode)

This method need not exist in the UserJavaScript.js file. If it does exist it can be used to perform initialization functions to the administrator’s specification. The parameter displayMode is used to help know which screen is being called. It can have the following values:

 

 

Value Purpose
ADD This shows that the add issue screen is being initiated
EDIT This shows that the edit issue screen is being initiated
REFRESH This shows that either the add or the edit screen is being refreshed
SEARCH This shows that the query or a report edit screen is being initiated

In most cases an ExtraView business rule can be used to initiate values on a form, but in some cases you need more interaction than a rule can provide. The following example shows how an ActiveX control is called within the loading of an add screen, and populates values into fields on the form:

 

 

function userJavaScriptOnload(displayMode) {
// IE only function to activate an ActiveX control and take some 
// of the values and populate them into a form
// Here we are getting the network hardware and configuration
// information on the user's computer
	
// For this to work, the host site being accessed by the client 
// must be a trusted site, and the security
// settings for the trusted site zone must be altered to allow 
// ActiveX controls to run without hindrance
  if (displayMode != ‘ADD’) return;	
  var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
  var service = locator.ConnectServer(".");
var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
  var d = document.editForm;
  var e = new Enumerator (properties);
  for (;!e.atEnd();e.moveNext ()) {
  // just take the first element returned and put into EV fields
    var p = e.item ();
    d.p_help_caption.value       = p.Caption;
    d.p_help_description.value   = p.description;
    d.p_help_dhcp_enabled.value  = p.DHCPEnabled;
    d.p_help_dhcp_sever.value    = p.DHCPServer;
    d.p_help_dns_host_name.value = p.DNSHostName;
    d.p_help_ip_address.value    = p.IPAddress(0);
    return;
  }
}