GabrielleReid
asked on
can anyone tweak my form cookie?
I got this script from Netmag the other day and I'd like to tweak it a bit but I can't seem to get it right.
The script warns users that they have already submitted a form when they click on submit, it gives the date/time of submission and gives then the option to re-submit.
And it goes like this:
-------------------------
<FORM ACTION="http://www.netmag.co.uk" NAME="myform">
<INPUT TYPE=BUTTON VALUE="Submit This Form" onClick="mySubmit()">
</FORM>
</CENTER>
<SCRIPT>
var alreadyclicked = "no";
var cookiename = "datesubmitted";
function mySubmit(){
if (alreadyclicked == "yes"){
alert("Form already being processed.");
return;
}
if (document.cookie.indexOf(c
var mystart =document.cookie.indexOf(c
var myend = document.cookie.indexOf(";
if (myend < 0){myend = document.cookie.length;}
var mydate = document.cookie.substring(
cookiename.length + 1, myend+1);
var myconfirm = "You submitted this form at ";
myconfirm = myconfirm + mydate;
myconfirm = myconfirm + ". Submit again?"
ret = confirm(myconfirm);
if (ret == false){
return;
}
}
mydate = new Date();
document.cookie = cookiename + "=" + mydate;
alreadyclicked = "yes";
document.myform.submit();
}
</SCRIPT>
------------------
I would like to tweak this script in two ways.
Firstly, I would like to REMOVE the option to re-submit,
and
secondly, I would like to set an expiry date of 3 months.
Any hot tips would be massively gratefully received.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is time to clean this abandoned question up.
I am putting it on a clean up list for CS.
<recommendation>
points to TTOM
</recommendation>
If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.
Cd&
I am putting it on a clean up list for CS.
<recommendation>
points to TTOM
</recommendation>
If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.
Cd&
Comment from expert accepted a answer
Computer101
E-E Admin
Computer101
E-E Admin
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
In the absence of responses, I may recommend DELETE unless it is clear
to me that it has value as a PAQ. Silence = you don't care
</note>
Cd&