Hi,
I have a forum page where say 10% of the time a persons posted comment gets repeated sometimes twice on rare occasions 5 times.
I only have one execute command, on testing with our dev site this never occurs, it only happens on the live site.
I think maybe it's because people on a slow connection repeatedly press the submit button thinking nothing is happening. I've put in javascript which is supposed to stop this happening.
Please can someone can suggest something, it's really frustrating and I'm getting heat from the client.
thanks here's the code
****************************************************
POST FORM
***************************************************
<html><body><head>
<head>
<script>
function submitIt2(form) {
var submitcount=0;
// check to see if the user entered Message
if (form.Message.value == "" {
alert("You must enter a Message"
form.Message.focus()
return false
}
else {
if (submitcount == 0) {
submitcount++;
return true;
}
else {
alert("This form has already been submitted. Thanks!"
return false;
}
}
return true
}
// End -->
</script>
</head>
<%if UID = "" OR left(UID,3)="#!#" then
Response.Write("To add comment to the forum, please login"
else%>
<table border=0 width=500 bgcolor=#fffeee border=5>
<hr color=#A70B8F height=5 width="500">
<tr width=500><td class=text>
<form method="post" action="../voting/OutputMessage.asp?SubID=<%=SubID%>&PollID=<%=PollID%>" id=form1 name=form1 onSubmit="return submitIt2(this)">
<input type="hidden" value="<%=PollID%>" name="PollID">
<p align="left"><b>Do you wish to reply to this persons comment</b></p>
<p align="left"><b>Message</b></p>
<textarea cols="55" rows="4" name="Message"></textarea><br>
<input type="submit" value="send" id=submit1 name=form1 >
</td></tr></table>
</form>
</BODY>
</HTML>
<%
end if
**********************************************************
response page
********************************************************
set myConn2 = Server.CreateObject("ADODB.Connection"
myConn2.Open Application("fiftyon_ConnectionString"
Set oRS2=Server.CreateObject("adodb.Recordset"
uSQL = " INSERT INTO TBL_FORUM_REPLY (PollID,SubID,Message,Name,DateStamp) VALUES ('" & PollID1 & "','" & Subject1 & "','" & Message1 & "','" & UID & "','" & DateTime & "')"
myConn2.execute uSQL
I have a forum page where say 10% of the time a persons posted comment gets repeated sometimes twice on rare occasions 5 times.
I only have one execute command, on testing with our dev site this never occurs, it only happens on the live site.
I think maybe it's because people on a slow connection repeatedly press the submit button thinking nothing is happening. I've put in javascript which is supposed to stop this happening.
Please can someone can suggest something, it's really frustrating and I'm getting heat from the client.
thanks here's the code
****************************************************
POST FORM
***************************************************
<html><body><head>
<head>
<script>
function submitIt2(form) {
var submitcount=0;
// check to see if the user entered Message
if (form.Message.value == "" {
alert("You must enter a Message"
form.Message.focus()
return false
}
else {
if (submitcount == 0) {
submitcount++;
return true;
}
else {
alert("This form has already been submitted. Thanks!"
return false;
}
}
return true
}
// End -->
</script>
</head>
<%if UID = "" OR left(UID,3)="#!#" then
Response.Write("To add comment to the forum, please login"
else%>
<table border=0 width=500 bgcolor=#fffeee border=5>
<hr color=#A70B8F height=5 width="500">
<tr width=500><td class=text>
<form method="post" action="../voting/OutputMessage.asp?SubID=<%=SubID%>&PollID=<%=PollID%>" id=form1 name=form1 onSubmit="return submitIt2(this)">
<input type="hidden" value="<%=PollID%>" name="PollID">
<p align="left"><b>Do you wish to reply to this persons comment</b></p>
<p align="left"><b>Message</b></p>
<textarea cols="55" rows="4" name="Message"></textarea><br>
<input type="submit" value="send" id=submit1 name=form1 >
</td></tr></table>
</form>
</BODY>
</HTML>
<%
end if
**********************************************************
response page
********************************************************
set myConn2 = Server.CreateObject("ADODB.Connection"
myConn2.Open Application("fiftyon_ConnectionString"
Set oRS2=Server.CreateObject("adodb.Recordset"
uSQL = " INSERT INTO TBL_FORUM_REPLY (PollID,SubID,Message,Name,DateStamp) VALUES ('" & PollID1 & "','" & Subject1 & "','" & Message1 & "','" & UID & "','" & DateTime & "')"
myConn2.execute uSQL