Location.js
window.onload = window_onLoad;
function window_onLoad() {
var win = parent.frames("LEFTPANE").window;
if (win && win.document.readyState == "complete")
win.selectFirst();
}
function load(id) {
if (isDirty) location.reload(); // force page reload
else {
var xml = '../Scripts/viewData.asp?tableName=location&whereID=' + id;
xmldso.XMLDocument.ondataavailable = loaded;
xmldso.XMLDocument.load(xml);
}
}
function loaded(){
var col;
if (col = document.all.tags('BUTTON')) {
for (var i=0; i < col.length; i++) {
col[i].disabled = false;
}
}
clearDirty();
}
function update(){
var theForm = document.frmLocation;
if (validateForm(theForm)) {
if (theForm.LocationId.value.length == 0) {
theForm.procName.value = "lw_addLocation";
theForm.actionBtn.value = "ADD";
}
clearDirty();
return true;
}
else
return false;
}
function remove() {
var theForm = document.frmLocation;
if (theForm.LocationId.value.length != 0) {
if (confirm(L_ConfirmDelete)) {
theForm.procName.value = "lw_deleteLocation";
theForm.actionBtn.value = "DELETE";
theForm.submit();
}
}
}
function refresh() {
var col;
if (col = document.all.tags('BUTTON')) {
for (var i=0; i < col.length; i++) {
if (col[i] != frmLocation.cmdSubmit)
col[i].disabled = true;
}
}
clearDirty();
}
// called from IFRAME script returned by DB action
function updateView(actn,id) {
switch (actn) {
case 'ADD':
// set new ID in form
document.frmLocation.elements("ID").value = id;
document.frmLocation.LocationId.value = id;
// return form to "CHANGE" mode
document.frmLocation.actionBtn.value = "CHANGE";
document.frmLocation.procName.value = "lw_changeLocation";
parent.frames("LEFTPANE").reloadList(id);
loaded();
break;
case 'DELETE':
document.frmLocation.reset();
parent.frames("LEFTPANE").reloadList(null);
break;
case 'CHANGE':
parent.frames("LEFTPANE").reloadList(id);
break;
}
}