Goal: delay execution of form submit
Code (Javascript + JScript ASP):
<%
Response.Write( "<OBJECT ID='IntraLaunch ' STYLE='display : none'
WIDTH=0 HEIGHT=0 CLASSID='CLSID: 0AE533FE-B805-4FD6-8AE1-A619FBEE7A23'
CODEBASE='Intra Launch.CAB#vers ion=5,0,0,3'>")
Response.Write( "<PARAM NAME='ImageLoc' VALUE='Null'>")
Response.Write( "<PARAM NAME='ImageSrc' VALUE='Null'>")
Response.Write( "<PARAM NAME='Run'
VALUE='F:\\Axys 3\\Clarity\\rep ort1.bat'>")
Response.Write( "<PARAM NAME='RunParms' VALUE=''>")
Response.Write( "<PARAM NAME='Display' VALUE=MAX'>")
Response.Write( "</OBJECT>")
%>
<script>
function UpdateRec(theFo rm, rec) {
tmp_checked = 0;
tmp_login = theForm.login.v alue;
tmp_year = theForm.tmp_yea r.value;
tmp_quarter = theForm.tmp_qua rter.value;
tmp_comm = theForm.comm.va lue;
if(theForm[rec].checked) {
tmp_checked = 1;
}
theForm.target = "MyFrame";
theForm.action = "qr_update.asp? axys=" + rec + "&tmp_quart er=" +
tmp_quarter + "&tmp_year= " + tmp_year + "&tmp_login =" + tmp_login +
"&tmp_check ed=" + tmp_checked + "&tmp_comm= " + tmp_comm;
theForm.submit( );
document.body.s tyle.cursor = 'wait';
}
function GenerateReport( theForm, rec, do_checkbox) {
document.IntraL aunch.RunParms = rec;
IntraLaunch.Exe cuteIt("Null");
if (do_checkbox) {
oldcomm = theForm.comm.va lue;
theForm.comm.va lue = "GSHOW";
theForm[rec].checked = true;
UpdateRec(theFo rm, rec);
theForm.comm.va lue = oldcomm;
}
tmp_year = theForm.tmp_yea r.value;
tmp_quarter = theForm.tmp_qua rter.value;
theForm.target = "MyOtherFra me";
theForm.action = "generate.asp?q uarter=" + tmp_quarter + "&year=" +
tmp_year + "&axys=" + rec;
var timer = setTimeout("doc ument."+theForm .name+".submit( )", 2000);
clearTimeout(ti mer);
//alert("Generate Report form object name: " + theForm.name);
//document.update form.submit();
}
background/explanation:
This is a task-status tracking web application. The purpose of this
code snippet is to automatically create two Axys reports as text
files, parse them into PDFs, and collate them into a third PDF, all on
the click of a button. GenerateReport is the method that's called
directly; the object declaration and UpdateRec are there for your
reference. The issue here is that it takes some time (a second or
two) to generate the text files via IntraLaunch, and I need to delay
the PDF operations (performed in generate.asp) until this is done.
The code itself is sound -- by uncommenting the last two lines,
everything functions smoothly, since the alert acts as a delay.
I have found that setTimeout is not executing the form submit at all:
I placed alerts in <body onload=> of both qr_update.asp and
generate.asp. The sans-setTimeout version pops an alert for each page,
but if I use setTimeout, I only get an alert for qr_update. I am
puzzled, though, because this seems to be the correct syntax for form
submission via setTimeout:
Please help!
Thanks,
Michelle
Code (Javascript + JScript ASP):
<%
Response.Write( "<OBJECT ID='IntraLaunch ' STYLE='display : none'
WIDTH=0 HEIGHT=0 CLASSID='CLSID: 0AE533FE-B805-4FD6-8AE1-A619FBEE7A23'
CODEBASE='Intra Launch.CAB#vers ion=5,0,0,3'>")
Response.Write( "<PARAM NAME='ImageLoc' VALUE='Null'>")
Response.Write( "<PARAM NAME='ImageSrc' VALUE='Null'>")
Response.Write( "<PARAM NAME='Run'
VALUE='F:\\Axys 3\\Clarity\\rep ort1.bat'>")
Response.Write( "<PARAM NAME='RunParms' VALUE=''>")
Response.Write( "<PARAM NAME='Display' VALUE=MAX'>")
Response.Write( "</OBJECT>")
%>
<script>
function UpdateRec(theFo rm, rec) {
tmp_checked = 0;
tmp_login = theForm.login.v alue;
tmp_year = theForm.tmp_yea r.value;
tmp_quarter = theForm.tmp_qua rter.value;
tmp_comm = theForm.comm.va lue;
if(theForm[rec].checked) {
tmp_checked = 1;
}
theForm.target = "MyFrame";
theForm.action = "qr_update.asp? axys=" + rec + "&tmp_quart er=" +
tmp_quarter + "&tmp_year= " + tmp_year + "&tmp_login =" + tmp_login +
"&tmp_check ed=" + tmp_checked + "&tmp_comm= " + tmp_comm;
theForm.submit( );
document.body.s tyle.cursor = 'wait';
}
function GenerateReport( theForm, rec, do_checkbox) {
document.IntraL aunch.RunParms = rec;
IntraLaunch.Exe cuteIt("Null");
if (do_checkbox) {
oldcomm = theForm.comm.va lue;
theForm.comm.va lue = "GSHOW";
theForm[rec].checked = true;
UpdateRec(theFo rm, rec);
theForm.comm.va lue = oldcomm;
}
tmp_year = theForm.tmp_yea r.value;
tmp_quarter = theForm.tmp_qua rter.value;
theForm.target = "MyOtherFra me";
theForm.action = "generate.asp?q uarter=" + tmp_quarter + "&year=" +
tmp_year + "&axys=" + rec;
var timer = setTimeout("doc ument."+theForm .name+".submit( )", 2000);
clearTimeout(ti mer);
//alert("Generate Report form object name: " + theForm.name);
//document.update form.submit();
}
background/explanation:
This is a task-status tracking web application. The purpose of this
code snippet is to automatically create two Axys reports as text
files, parse them into PDFs, and collate them into a third PDF, all on
the click of a button. GenerateReport is the method that's called
directly; the object declaration and UpdateRec are there for your
reference. The issue here is that it takes some time (a second or
two) to generate the text files via IntraLaunch, and I need to delay
the PDF operations (performed in generate.asp) until this is done.
The code itself is sound -- by uncommenting the last two lines,
everything functions smoothly, since the alert acts as a delay.
I have found that setTimeout is not executing the form submit at all:
I placed alerts in <body onload=> of both qr_update.asp and
generate.asp. The sans-setTimeout version pops an alert for each page,
but if I use setTimeout, I only get an alert for qr_update. I am
puzzled, though, because this seems to be the correct syntax for form
submission via setTimeout:
Please help!
Thanks,
Michelle
Comment