I have a page with a form and a sumit button. Also, within this form I have a link that calls a javascript function, submitform():
function submitform(){
var multiform = window.document.frmSearch
multiform.setAttribute("me
thod", "post");
multiform.setAttribute("ac
tion", "XCustProfileMulti.cfm");
multiform.setAttribute("ta
rget", "multicust");
window.open('XCustProfileM
ulti.cfm',
'multicust', 'scrollbars=no,menubar=no,
height=100
,width=350
,resizable
=no,toolba
r=no,statu
s=no');
multiform.submit();
The function above opens a new window and on that new page I have another function, printit(), that opens a print dialog box so the user can print out the page which is created and based on the information sent from the form:
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-34
0A-11D0-A9
6B-00C04FD
705A2"></O
BJECT>';
document.body.insertAdjace
ntHTML('be
foreEnd', WebBrowser);
WebBrowser1.ExecWB(6, 1);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}window.close();
}
My problem is this: If I simply click the submit button on the form, it submits just as expected, and if I click the link that calls the submitform() function, that also works as expected . . . but once I have clicked the link that calls the submitform() function, then try to submit the form by pressing the submit button, it still calls the submitform() function, unless I physically refresh the page.
I tried using "javascript:window.opener.
location.r
eload()" on the new window that the submitform() function opens, but I get a prompt box asking if I want to re-sumbit the information, which isn't an acceptable solution.
My submit button: [input type="submit" value="SEARCH"]
My link that calls the submitform() function: <a href="##" onClick="submitform()">Cli
ck here to print sheets</a>
I sometimes tend to use javascript that is abit over my head and am kinda lost as to how to solve this.
Any ideas? I can provide more info if this isn't clear.
Max