mickeymouse Posted June 20, 2020 Share Posted June 20, 2020 My page allows the user to type in a number and click Enter or press the Enter Key (submit button). My next page then process that number. But if the user clicks twice (or presses the Enter Key twice), my next page gets the number twice. How can I prevent the user from doing this double entry? e.g. Can I disable the submit button after it's been used? Tks Link to comment Share on other sites More sharing options...
dsonesuk Posted June 20, 2020 Share Posted June 20, 2020 (edited) Yes! Use onsubmit event of form, not click of button. Edited June 20, 2020 by dsonesuk Link to comment Share on other sites More sharing options...
mickeymouse Posted June 21, 2020 Author Share Posted June 21, 2020 Sorry. I guess I wasn't clear. I am using "onsubmit" in Form. My input tag is a "type=submit". When the user clicks on this 'submit' button more than once (or presses the "Return" key more than once) I end up with multiple entries. My "onsubmit" goes to a function that checks to see if the input number is valid and if OK the submission is allowed (return true). So, how do I prevent multiple submissions from taking place. There should not be another entry until there is a visible server response to the first submission. Link to comment Share on other sites More sharing options...
JMRKER Posted June 29, 2020 Share Posted June 29, 2020 Disable the element (button) in the submission portion of your code. Button will not be re-enabled until the page is reloaded after processing of the form. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now