Hmmm, the Javascript sounds interesting along with a redirect. Do you know of any examples of that type of script that I can steal, er, borrow.
| [reply] |
<script language="Javascript1.1">
function justOneClick() {
myform.clickme.disabled=true; // don't click me twice
return true; // so the submit will go ahaed
}
</script>
...
<form method="POST" name="myform" onSubmit="return justOneClick()">
...
<input type="submit" name ="clickme">
</form>
| [reply] [d/l] |
Ah ha, cool. That works. Of course, I had to mess with it and break it.
I have two submit buttons, a Preview and a Post. As is, it disables the Post submit and I get an alert if the system is slower than the timeout. However, if I add a disable for the Preview button, my form variable gets eaten and it always posts. Since my script checks for Preview and otherwise posts the message, it works, but Preview is now broken. Here's what I did to the script:
<script language="Javascript1.1">
function justOneClick() {
message.Post.disabled=true; // don't click me twice
message.Preview.disabled=true; // don't click me twice
setTimeout('alert("Your form has been submitted. Please be patien
+t, I\\'m working on it.")', 2000);
return true; // so the submit will go ahaed
}
</script>
I can live with only disabling post as it's the one that can take a while. Usually, the system is plenty fast for previewing. Apparently the name of the button gets eaten all together as my Post or your clickme doesn't exist in the form after the submit. Weird.
Thanks.
| [reply] [d/l] |
<form onsubmit="if(this.submitted){ alert("please be patient"); return
+ false;}; this.submitted=true">
...
</fode>
| [reply] [d/l] |
Here's a transfer chunk.. time is in millisecs
<script>
transfer_location = "http://new_url/";
pause_time = 600;
function transfer() {
if (document.images)
setTimeout('location.replace("'+transfer_location+'");',pause_tim
+e);
else
setTimeout('location.href = transfer_location;',pause_time);
}
</script>
| [reply] [d/l] |
| [reply] |
True, everything has a gotcha. Thus far, the Javascript has taken care of the problem. However, it's not perfect. I'm in the process of porting all this code for mod_perl and re-writing major sections. Doing the redirect would be simpler to add at that time.
Assigning a unique id would be the best solution; however, the message and the reply dialogue are just html pages, so it's not possible as far as I know without a fairly major architectural change.
| [reply] |