Forum Moderators: open

Message Too Old, No Replies

Does a double click submit a form twice?

         

isNaN

4:54 pm on May 13, 2002 (gmt 0)

10+ Year Member



True of False

When u double click to submit, it will submit form twice.

Brett_Tabke

5:00 pm on May 13, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



(welcome to the board)

False - modern browsers (v3+) contain doubleclick protection. However, a user can click - wait a few seconds and click again before the previous page generates. So, you do need some sort of double click protection built in if it is a mission critical activity.

Lets try it right now, I'll hit submit, count to three, and click again (if I can).

rcjordan

5:19 pm on May 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>So, you do need some sort of double click protection built in if it is a mission critical activity.

Yes, absolutely! (If you only knew.) In fact, if you're going forms-to-database it's almost essential to trap this type of error or you'll soon end up with an unhealthy number of duplicate records in the file.

We use three error-trapping routines in the major form my site uses. #1 is a javascript that visually alters the Submit button when clicked. #2 compares IP numbers of the last 2 form users and stops them with an alert/error message if they are duplicates (the user can manually override, since there are some valid reasons to file a duplicate). #3 A timed minimum interval between submissions.

isNaN

6:06 pm on May 13, 2002 (gmt 0)

10+ Year Member



thanks all of u :)

moonbiter

8:17 pm on May 13, 2002 (gmt 0)

10+ Year Member



Another method (if you are in a controlled IE 4+ or Mozilla/NS6 environment like a corporate intranet): You can set the disabled attribute of the submit button to "disabled" via javascript once the button has been clicked.

Filipe

10:04 pm on May 13, 2002 (gmt 0)

10+ Year Member



Another method which provides other certain safeties is just to let them submit as many times as they want. However, in order to update the posted information in the database or to make use of the data, make them submit just after a confirmation page.

I used to have a problem where users would notice an error in the form after pressing SUBMIT, so they'd click STOP in their browser, fix the info, and then proceed.

By applying the previously mentioned tactics on the confirmation page, you leave room for less error.

kevinj

2:37 am on May 16, 2002 (gmt 0)

10+ Year Member



Where might one go to see sample code for ways of preventing duplicate records from click happy users?

sazaba

6:31 pm on May 16, 2002 (gmt 0)



Hey, I just work on this topic... here is my javascript coding... hope it helps!!

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

n=0
function test1(form) {
if (n==0) {
alert("Your from submitted!");
n++;
return true;
} else {
alert("Please wait for reply!");
return false;
}
}
// End -->
</script>
</head>
<body>

<form name=form action="" target=_blank onsubmit="return test1(this);">
<input type=text name=value1>
<input type=submit value=submit>
</form>

</body>
</html>