In order to prevent users from creating multiple submissions, I have implemented JavaScript to disable the submit button after it has been pressed.
My form page is processed by mailer.php, and then directed to a success page. Now, however, my form submits and is directed to mailer.php, and it appears the data is not submit.
I assume it has something to do with the onsubmit
overriding the action=mailer.php
.
Is this the cause and how can I fix it?
<form
onsubmit="document.getElementById('submit').disabled=true;document.getElementById('submit').value='Submitting, please wait...';"
action="mailer.php"
method="post">
<input
name="firstname"
type="text"
placeholder="First Name"
class="form-content"/>
</br>
<input
name="surname"
type="text"
placeholder="Surname"
class="form-content"/>
</br>
[edit: removed irrelevant inputs]
<div id="submitbutton">
<input name="submit" type="submit" value="Submit" id="submit">
</div>
</form>