I am currently facing some order duplication issues. Without going into too much detail, I had a question about the following. Is there any possibility that this can trigger a submit twice?
<button type="submit" onclick="review.save()"></button>
review.save()
will handle the submission of the form - so in fact the type=submit isn't needed here. But I want to establish whether this CAN cause the browser to submit twice. On the server logs the 2 submits were about 10 seconds apart.
I am currently facing some order duplication issues. Without going into too much detail, I had a question about the following. Is there any possibility that this can trigger a submit twice?
<button type="submit" onclick="review.save()"></button>
review.save()
will handle the submission of the form - so in fact the type=submit isn't needed here. But I want to establish whether this CAN cause the browser to submit twice. On the server logs the 2 submits were about 10 seconds apart.
- The browser does not submit twiche. It submits, when the button is clicked. What your function call review.save() does is on another page... ;) – I'm with Monica Commented Nov 5, 2013 at 12:37
- Impatient users clicking twice maybe? Its a good idea to disable the button so as the users cannot click twice. – Fred Commented Nov 5, 2013 at 12:37
2 Answers
Reset to default 5You need to prevent default browser behaviour, for example:
<button type="submit" onclick="review.save(); return false;"></button>
Add a return false
to your Button or better the 'oncklick' event!
Like:
<button type="submit" onclick="review.save();return false;"></button>
It "stops" the default browser behaviour of following links (in that case).
Edit: To slow :/