Recently my server has been slow to respond when a user clicks submit and then because
the page is just lingering they keep clicking submit resulting in multiple submissions
and multiple response emails being generated.
I tried adding an onClick disable submit and changing the text in the submit button to
“form submitted… waitng for server” but if the user skips over the captcha and clicks
on submit it bypasses the validation allowing a partially completed form to submit. I also discovered that the POST variable from the form containing the SUBMIT value also gets lost.
I also tried doing this at the end of the validation process but got the same problem.
Is there a way to disable the submit button without interfering with the POST array.
I tried it two different ways:
- adding this to the <submit> tag
onclick="this.form.submit(); this.disabled = true; this.value = 'Submitting the form';"
-
adding this to the end of my valididation:
document.property_tax_form1.submit_button.value = "Form Submitted...Waiting for Server"; document.property_tax_form1.submit_button.disabled=true ;
What happens is without these the POST array has this at the end: submit_button = SUBMIT and this is missing when I add the js. The validation on the back end for the captcha begins with if (isset($_POST[‘submit_button’]))
so because there is no submit_button field nothing happens in the validation.