Hi all,
I'm new to these boards and my javascript experience is fairly limited
and basic so please bear with me. Anyway, on to the question and some
background. I'm developing using ColdFusion 4.5 and a good deal of the
page processing depends on whether or not a control is defined. To
prevent users from clicking on a submit button more than once or
clicking on another submit button before the page has finished
processing I have decided to use javascript to disable all of the
submit buttons on the page. However, this is preventing submission of
the form. When I try forcing the submit in the function, the
processing that should occur from clicking the submit button is
ignored and the submit button is not defined. Here is the code I am
using the commented code is different things I have tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled </title>
<script language="JavaS cript">
function fxnDisableBtn(f oo)
{
//alert(foo.type + ", " + foo.name + ", " + foo.value);
//document.frm1.f oo.click();
//document.frm1.s ubmit();
document.frm1.b tnSave.disabled = true;
document.frm1.b tnGoBack.disabl ed = true;
document.frm1.b tnReturn.disabl ed = true;
document.frm1.b tnForward.disab led = true;
//document.frm1.s ubmit();
//document.frm1.f oo.click();
switch(foo.name ){
case "btnSave":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnSave.click();
foo.click();
break;
//document.frm1.b tnSave.click();
case "btnGoBack" :
//alert(foo.type + ", " + foo.name);
document.frm1.b tnGoBack.click( );
//foo.click();
break;
case "btnReturn" :
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnReturn.click( );
break;
case "btnForward ":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnForward.click ();
break;
}
alert(foo.type + ", " + foo.name + ", " + foo.value + ", " +
foo.disabled + ", " + foo.click()); //debugging and checking foo
}
</script>
</head>
<body>
<form name="frm1" action="#Applic ation.RootPath#/master.cfm?"
method="post"></form>
<input type=submit name="btnSave" value="Save (Does Not Forward)"
onclick="fxnDis ableBtn(btnSave );">
<br><br>
<input type=submit name="btnGoBack " value=" <- Back "
onclick="fxnDis ableBtn(btnGoBa ck);"> &nb sp;
<input type=submit name="btnReturn " value="Return"
onclick="fxnDis ableBtn(btnRetu rn);"> &nb sp;
<input type=submit name="btnForwar d" value="Forward"
onclick="fxnDis ableBtn(btnForw ard);">
<br><br>
</body>
</html>
I'm new to these boards and my javascript experience is fairly limited
and basic so please bear with me. Anyway, on to the question and some
background. I'm developing using ColdFusion 4.5 and a good deal of the
page processing depends on whether or not a control is defined. To
prevent users from clicking on a submit button more than once or
clicking on another submit button before the page has finished
processing I have decided to use javascript to disable all of the
submit buttons on the page. However, this is preventing submission of
the form. When I try forcing the submit in the function, the
processing that should occur from clicking the submit button is
ignored and the submit button is not defined. Here is the code I am
using the commented code is different things I have tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled </title>
<script language="JavaS cript">
function fxnDisableBtn(f oo)
{
//alert(foo.type + ", " + foo.name + ", " + foo.value);
//document.frm1.f oo.click();
//document.frm1.s ubmit();
document.frm1.b tnSave.disabled = true;
document.frm1.b tnGoBack.disabl ed = true;
document.frm1.b tnReturn.disabl ed = true;
document.frm1.b tnForward.disab led = true;
//document.frm1.s ubmit();
//document.frm1.f oo.click();
switch(foo.name ){
case "btnSave":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnSave.click();
foo.click();
break;
//document.frm1.b tnSave.click();
case "btnGoBack" :
//alert(foo.type + ", " + foo.name);
document.frm1.b tnGoBack.click( );
//foo.click();
break;
case "btnReturn" :
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnReturn.click( );
break;
case "btnForward ":
//alert(foo.type + ", " + foo.name);
//document.frm1.b tnForward.click ();
break;
}
alert(foo.type + ", " + foo.name + ", " + foo.value + ", " +
foo.disabled + ", " + foo.click()); //debugging and checking foo
}
</script>
</head>
<body>
<form name="frm1" action="#Applic ation.RootPath#/master.cfm?"
method="post"></form>
<input type=submit name="btnSave" value="Save (Does Not Forward)"
onclick="fxnDis ableBtn(btnSave );">
<br><br>
<input type=submit name="btnGoBack " value=" <- Back "
onclick="fxnDis ableBtn(btnGoBa ck);"> &nb sp;
<input type=submit name="btnReturn " value="Return"
onclick="fxnDis ableBtn(btnRetu rn);"> &nb sp;
<input type=submit name="btnForwar d" value="Forward"
onclick="fxnDis ableBtn(btnForw ard);">
<br><br>
</body>
</html>
Comment