M
Mic
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='IntraLaunch.CAB#version=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:\\Axys3\\Clarity\\report1.bat'>")
Response.Write("<PARAM NAME='RunParms' VALUE=''>")
Response.Write("<PARAM NAME='Display' VALUE=MAX'>")
Response.Write("</OBJECT>")
%>
<script>
function UpdateRec(theForm, rec) {
tmp_checked = 0;
tmp_login = theForm.login.value;
tmp_year = theForm.tmp_year.value;
tmp_quarter = theForm.tmp_quarter.value;
tmp_comm = theForm.comm.value;
if(theForm[rec].checked) {
tmp_checked = 1;
}
theForm.target = "MyFrame";
theForm.action = "qr_update.asp?axys=" + rec + "&tmp_quarter=" +
tmp_quarter + "&tmp_year=" + tmp_year + "&tmp_login=" + tmp_login +
"&tmp_checked=" + tmp_checked + "&tmp_comm=" + tmp_comm;
theForm.submit();
document.body.style.cursor = 'wait';
}
function GenerateReport(theForm, rec, do_checkbox) {
document.IntraLaunch.RunParms = rec;
IntraLaunch.ExecuteIt("Null");
if (do_checkbox) {
oldcomm = theForm.comm.value;
theForm.comm.value = "GSHOW";
theForm[rec].checked = true;
UpdateRec(theForm, rec);
theForm.comm.value = oldcomm;
}
tmp_year = theForm.tmp_year.value;
tmp_quarter = theForm.tmp_quarter.value;
theForm.target = "MyOtherFrame";
theForm.action = "generate.asp?quarter=" + tmp_quarter + "&year=" +
tmp_year + "&axys=" + rec;
var timer = setTimeout("document."+theForm.name+".submit()", 2000);
clearTimeout(timer);
//alert("GenerateReport form object name: " + theForm.name);
//document.updateform.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:
http://groups.google.com/[email protected]&rnum=10
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='IntraLaunch.CAB#version=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:\\Axys3\\Clarity\\report1.bat'>")
Response.Write("<PARAM NAME='RunParms' VALUE=''>")
Response.Write("<PARAM NAME='Display' VALUE=MAX'>")
Response.Write("</OBJECT>")
%>
<script>
function UpdateRec(theForm, rec) {
tmp_checked = 0;
tmp_login = theForm.login.value;
tmp_year = theForm.tmp_year.value;
tmp_quarter = theForm.tmp_quarter.value;
tmp_comm = theForm.comm.value;
if(theForm[rec].checked) {
tmp_checked = 1;
}
theForm.target = "MyFrame";
theForm.action = "qr_update.asp?axys=" + rec + "&tmp_quarter=" +
tmp_quarter + "&tmp_year=" + tmp_year + "&tmp_login=" + tmp_login +
"&tmp_checked=" + tmp_checked + "&tmp_comm=" + tmp_comm;
theForm.submit();
document.body.style.cursor = 'wait';
}
function GenerateReport(theForm, rec, do_checkbox) {
document.IntraLaunch.RunParms = rec;
IntraLaunch.ExecuteIt("Null");
if (do_checkbox) {
oldcomm = theForm.comm.value;
theForm.comm.value = "GSHOW";
theForm[rec].checked = true;
UpdateRec(theForm, rec);
theForm.comm.value = oldcomm;
}
tmp_year = theForm.tmp_year.value;
tmp_quarter = theForm.tmp_quarter.value;
theForm.target = "MyOtherFrame";
theForm.action = "generate.asp?quarter=" + tmp_quarter + "&year=" +
tmp_year + "&axys=" + rec;
var timer = setTimeout("document."+theForm.name+".submit()", 2000);
clearTimeout(timer);
//alert("GenerateReport form object name: " + theForm.name);
//document.updateform.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:
http://groups.google.com/[email protected]&rnum=10
Please help!
Thanks,
Michelle