PDA

Click to See Complete Forum and Search --> : Hitting submit more that once.


glitch13
Jan 29th, 2001, 10:53 AM
I have two problems, both dealing with the same thing, I think theyre pretty common, so there might be some 'canned' solution:

I have a forum system on my site that I wrote, but heres the probs i cant figure out:


1:
Users hitting submit twice when posting (impatient little buggers!), and usually this will result in their post getting submitted twice.

2:
people who post, then out of stupidity, hit the back button to try to edit their post and hit submit again, thus posting an original version and an edited version.


I see that a lot of sites have the page expire on submission to work around the second problem, how do you do that?

as for the first one, my kneejerk reaction is to test the database to see if a record with the exact same content has been posted (excluding the index of course), and if so, dont write it again, but i wanted to check to see if there is a easier way.


thanks in advance!

Ianpbaker
Jan 30th, 2001, 03:15 AM
Hi glitch13

with the expiring of pages if you are using asp for this foeum of yours, you can put this at the top of you code

Response.Expires = 1

as for your first problem, there isn't really any easy way of doing it apart from as you said.

Hope this helps

Ian

sebs
Jan 30th, 2001, 07:15 AM
for youyr first prob, try:

<input type=button name=submit onClick="mySubmit();">

and make a javascript function,

function mySubmit(){
var isSubmit
if (isSubmit != True){
myForm.submit();
}else{
alert('You already hit the submit dude!');
}


try this and let us know!!

glitch13
Feb 3rd, 2001, 04:46 PM
thanks, but I just want it to be transparent, like they can keep hitting submit, but only the first click will count.

Clunietp
Feb 4th, 2001, 10:39 PM
just modify Sebs code:

function mySubmit(){
var isSubmit
if (isSubmit != True){
myForm.submit();
}else{
// do nothing
}