I think I have a classic problem, but so far I have not been able to find a working solution.
I have a form, the user clicks "Submit", and everything works fine using the PRG template and performs verification both on the client side and on the server side.
The problem occurs when any user (let's say that he has entered valid inputs) clicks more and then quickly before the server script completes its execution ...
I don’t get a duplicate entry because I took care of this, but the browser does not go to my “thanks for submitting the page”. Instead, it re-submits the same page with the same values, and I get the user errors that I set to warn the user that he is trying to enter data already stored in the database. Details sent in the first place are in the database, but the user does not have the opportunity to know this.
I tried to disable the submit button in the send event using jQuery, but in this case the data is not sent.
HTML
<div id="send-button-container">
<input id="send-emails" type="submit" name="send_emails" value="Send"/>
</div>
JQuery
$(document).ready(function(){
$('#mail-form').submit(function(){
$('#send-emails').attr('disabled','disabled');
});
});
I am wondering if I can force the feed using Javascript after the button is disabled, as well as how to handle UA with Javascript disabled.
Thanks in advance