natty
05-15-2003, 09:54 AM
hi all
im having real problems with users double clicking submit buttons.
these buttons are <input type=image ...
i have tried various approaches with no success.
i first tried
<form onsubmit="return foo();" ...>
<input type=hidden name=doneit value=''...
<input type=image name=submit ...
<head ..<scr..
function foo(){
if (d.forms[0].doneit == ''){
document.forms[0].submit.disabled = true;
return true;
}else{
return false;
}
}
the trouble with that is that it didnt work because it didnt seem to disable the button.
then tried
if(blah){
document.forms[0].done.value = true;
document.forms[0].action = '';
document.forms[0].submit();
return true;
}else{
return false;
}
but that didnt work because the return false on the second click stopped the submitting of the page.
then i tried to make the submit button in to a hyperlink anad do all the form action in the JS
function foo(){
if (document.forms[0].done.value == ''){
var anchors = document.anchors;
for (var i=0;i<anchors.length;i++){
anchor = anchors[i];
if(anchor.name == 'submit'){
anchor.href="";
break;
}
}
document.forms[0].done.value = true;
document.forms[0].action = '2.html';
document.forms[0].submit();
}
}
but that didnt work becasue on the second click the page jumped to the top, having taken the href='' to mean href=# ...
surely there must be a way to do this ?
thanks in advance.. (i hope)
nat
im having real problems with users double clicking submit buttons.
these buttons are <input type=image ...
i have tried various approaches with no success.
i first tried
<form onsubmit="return foo();" ...>
<input type=hidden name=doneit value=''...
<input type=image name=submit ...
<head ..<scr..
function foo(){
if (d.forms[0].doneit == ''){
document.forms[0].submit.disabled = true;
return true;
}else{
return false;
}
}
the trouble with that is that it didnt work because it didnt seem to disable the button.
then tried
if(blah){
document.forms[0].done.value = true;
document.forms[0].action = '';
document.forms[0].submit();
return true;
}else{
return false;
}
but that didnt work because the return false on the second click stopped the submitting of the page.
then i tried to make the submit button in to a hyperlink anad do all the form action in the JS
function foo(){
if (document.forms[0].done.value == ''){
var anchors = document.anchors;
for (var i=0;i<anchors.length;i++){
anchor = anchors[i];
if(anchor.name == 'submit'){
anchor.href="";
break;
}
}
document.forms[0].done.value = true;
document.forms[0].action = '2.html';
document.forms[0].submit();
}
}
but that didnt work becasue on the second click the page jumped to the top, having taken the href='' to mean href=# ...
surely there must be a way to do this ?
thanks in advance.. (i hope)
nat