PDA

View Full Version : No. of clicks for Submit button



real_estate
07-29-2006, 07:21 AM
How do I determine if the user clicked a "Submit" button twice in the page?

djr33
07-30-2006, 07:32 AM
No, you can't. It's not something that is sent to the next page.

However, I assume you are trying to prevent spamming/duplicate messages/etc.

The way to do that is to use a database (or other tracking method, perhaps txt files on the server) to keep track of the last submission. If it matches, ignore the second one.

Really, that's the only thing you can do.

However, you could also add javascript to the submit button that would grey it out once clicked one time, so you couldn't click it again. However, that isn't foolproof, and there are ways to make it submit again. But, it would at least limit it, then you could do the above to make it flawless.