If I hit ENTER twice very quickly after filling an input box in a form, Google Chrome sends multiple requests (two in this case) which causes problems in my application.
I tried to disable the submit button via javascript but this didn’t work since Chrome sends two separate page requests.
Test Page: http://vippad.com/test.php
Any ideas?
How does this relate to HTML or XHTML? 
You’re right I’m sorry! Please move the thread to the right place if you can.
I’ve made a quick test page by the way.
Browse to the following page with Chrome, enter anything in the input box and hit ENTER quickly multiple times.
http://vippad.com/test.php
Same behaviour in Chrome, Opera, IE8 and Safari. Only Firefox requests the page just once.
In all fairness, if you hit the Enter key twice, you should send two requests. In some situations, this could very well be what is intended. Firefox is the one doing it wrong here.
If you want to prevent it, you should check for multiple, identical submissions from the same IP address within a certain time frame.
I coded a similar check anyway but it’s been a little harder since the form is in a Facebook application frame (Facebook IPs request the pages).
Users tend to click or hit ENTER multiple times frequently and those excessive requests must be handled and filtered in this application’s case.
I’m writing into a form box right now and it should not send two identical posts if I hit “Post Quick Reply” twice. Do you agree?
No because there is no application running anywhere BUT on the server that can do any processing of what you have entered. You hit submit twice and therefore there are two copies of the form data sent to the server. There is no way on the client end to prevent that. Even if you build some JavaScript to disable the submit button after the first submit that will not work if JavaScript is disabled. The validation for multiple copies MUST be done on the server as that’s the only place where code can run to do that test for everyone.
Of course validation has to be done serverside. The problem I’m trying to describe here is different.
Suppose a user clicked the submit button twice accidentally and first request is considered valid but not the second by the serverside script.
Now the user will see the error/warning page (although he made one valid request just before), since the second request is rendered by the the browser not the first one (except Firefox).
Depending on the circumstances, you should either not post any warning at all (if it’s an environment where a duplicate entry would never occur), or you should notify the user that they sent the request twice but that you removed one of the entries while adding the other one to the database.
I still just cannot see a practical reason for a browser to process multiple clicks / ENTERs before showing the resulting page of each post request.
I also cannot think much uses of a form element in a web page where it’d make sense to click a submit button 5 times in 1 second.
I’ve used such functionality before as a user, so it’s not without merit. Makes processing faster, if you need to do a lot of manual work without access to the database.