Coding *.js

Each *.htm file uses the functions in a corresponding JavaScript file. For example, Activity.htm (all language versions) uses the functions in Activity.js.

Calling viewData.asp From the window_onLoad Function

The onLoad event of the window (the RIGHTFRAME when the *.htm file is loading) triggers a call to the window_onLoad function when the *.htm file has loaded. The window_onLoad function loads list boxes in the right pane. The following code fragment from window_onLoad in ActivityType.js loads the grade scale drop-down list box on the Activity form. The code shows how xmldoc (an XMLDocument object) is loaded from a URL. The last line of code calls the copyToSel function, which copies the value from the XML node into the SELECT tag.var xmldoc=xmldso_gs.XMLDocument;

xmldoc.async=false;
xmldoc.load('../Scripts/viewData.asp?tableName=gradeScale&fieldList=gradeScaleId,Name&sortBy=Name');
copyToSel(xmldoc.documentElement,document.frmActivityType.GradeScaleId);

Calling viewData.asp from the load Function

The load function, which is called from the selectCell function, initiates the loading of a specific record into the right pane of the form. Data Binding Intrinsic HTML Objects to xmldso describes in detail how elements on the form are bound to XML recordset fields.

Calling Functions to Enable and Disable Buttons

Two functions in *list.js, loaded and refresh, handle the disabled property of the buttons on forms. The loaded function sets disabled to FALSE when the right pane is first loaded with data. When a user clicks the Refresh button, the refresh function is called, setting the disabled property to TRUE.

The following code fragment enables all buttons:

var col;
   if (col = document.all.tags('BUTTON')) {
      for (var i=0; i < col.length; i++) {
         col[i].disabled = false;

The following code fragment disables the Change button on the Activity form:

var col;
   if (col = document.all.tags('BUTTON')) {
      for (var i=0; i < col.length; i++) {
         if (col[i] != frmActivityType.cmdSubmit)
            col[i].disabled = true;

Special Functions

The following table lists the additional functions that only Group.js, PersonGroup.js, and Person.js contain.

Functions in Group.js

Function Implementation
setInfo Translating Data Values for Check Boxes
updateInfo Translating Check Boxes to Data Values
updateLoc Populating List Boxes
updateGS Populating List Boxes
checkDate Comprehensive Data Validation
checkOccupancy Comprehensive Data Validation

In addition Group.js contains code for the viewActivityList and viewMembership functions.

Functions in Person.js

Function Implementation/code
setInfo Translating Data Values for Check Boxes
updateInfo Translating Check Boxes to Data Values

In addition, Person.js contains code for the viewSchedule function.

Functions in PersonGroup.js

Function Implementation
setUserName Populating List Boxes

In addition, PersonGroup.js contains code for the addClass and removeClass functions.