All,
I have some remote scripts that queries a database. However there is no feedback to the user that anything is happening. So I created a progress bar that I want to update throughout the execution of the script. However all of my efforts to update (and the browser actually display) the progress bar have failed. It seems that the drawing messages/execution inside the browser are never being handled, therefore not updating my progressbar. Has anyone done this before. Here is my code
<code>
function MaterialType_OnChange() {
var RSTestResultSearch = RSGetASPObject("RSTestResultSearch.asp");
var mtId = new String();
var mustQuery = true;
var rows = new String();
var cols = new String();
var arrTemp = new Array();
var mtIdx, co, i;
//Start the progress bar
progressBar.SetPosition(0);
if(document.mainForm.materialType.value == -1) {
DisableSelect("vendor", "Step [2]");
DisplaySelCnt("vendor");
DisableSelect("pattern", "Step [3]");
DisplaySelCnt("pattern");
return;
}
progressBar.SetPosition(2);
//Enable/Disable selects
EnableSelect("vendor");
DisableSelect("pattern", (document.mainForm.patternAll.checked)?"All":"Step [3]");
//Get the selected material id
mtId = document.mainForm.materialType[document.mainForm.materialType.selectedIndex].value;
//Check if the query has already been done
for(i=0;i<arrMaterialType.length;i++) {
if(arrMaterialType.id == mtId) {
mtIdx = i;
if(arrMaterialType.arrVendor.length > 0) {
mustQuery = false;
break;
}
}
}
progressBar.SetPosition(4);
//Query vendors synchronously
if(mustQuery == true) {
co = RSTestResultSearch.getVendors(mtId);
//Check for remote script errors
if(CheckRSErrors(co) == false)
return;
rows = String(co.return_value).split("|");
for(i=0;i<rows.length;i++) {
cols = String(rows).split(",");
arrMaterialType[mtIdx].AddVendor(cols[0], cols[1]);
}
}
progressBar.SetPosition(6);
for(i=0;i<arrProductGroup.length;i++) {
if(arrProductGroup.mt_id == document.mainForm.materialType.value) {
arrTemp[arrTemp.length] = arrProductGroup;
}
}
progressBar.SetPosition(8);
WriteProductGroupTable(arrTemp);
progressBar.SetPosition(10);
FillVendorSelect(mtIdx);
DisplaySelCnt("vendor");
progressBar.SetPosition(0);
}
</code>
The SetPosition calls never update the progressbar. Help!!!
I have some remote scripts that queries a database. However there is no feedback to the user that anything is happening. So I created a progress bar that I want to update throughout the execution of the script. However all of my efforts to update (and the browser actually display) the progress bar have failed. It seems that the drawing messages/execution inside the browser are never being handled, therefore not updating my progressbar. Has anyone done this before. Here is my code
<code>
function MaterialType_OnChange() {
var RSTestResultSearch = RSGetASPObject("RSTestResultSearch.asp");
var mtId = new String();
var mustQuery = true;
var rows = new String();
var cols = new String();
var arrTemp = new Array();
var mtIdx, co, i;
//Start the progress bar
progressBar.SetPosition(0);
if(document.mainForm.materialType.value == -1) {
DisableSelect("vendor", "Step [2]");
DisplaySelCnt("vendor");
DisableSelect("pattern", "Step [3]");
DisplaySelCnt("pattern");
return;
}
progressBar.SetPosition(2);
//Enable/Disable selects
EnableSelect("vendor");
DisableSelect("pattern", (document.mainForm.patternAll.checked)?"All":"Step [3]");
//Get the selected material id
mtId = document.mainForm.materialType[document.mainForm.materialType.selectedIndex].value;
//Check if the query has already been done
for(i=0;i<arrMaterialType.length;i++) {
if(arrMaterialType.id == mtId) {
mtIdx = i;
if(arrMaterialType.arrVendor.length > 0) {
mustQuery = false;
break;
}
}
}
progressBar.SetPosition(4);
//Query vendors synchronously
if(mustQuery == true) {
co = RSTestResultSearch.getVendors(mtId);
//Check for remote script errors
if(CheckRSErrors(co) == false)
return;
rows = String(co.return_value).split("|");
for(i=0;i<rows.length;i++) {
cols = String(rows).split(",");
arrMaterialType[mtIdx].AddVendor(cols[0], cols[1]);
}
}
progressBar.SetPosition(6);
for(i=0;i<arrProductGroup.length;i++) {
if(arrProductGroup.mt_id == document.mainForm.materialType.value) {
arrTemp[arrTemp.length] = arrProductGroup;
}
}
progressBar.SetPosition(8);
WriteProductGroupTable(arrTemp);
progressBar.SetPosition(10);
FillVendorSelect(mtIdx);
DisplaySelCnt("vendor");
progressBar.SetPosition(0);
}
</code>
The SetPosition calls never update the progressbar. Help!!!