javascripthtmlruby-on-railsforms

How to submit form only once after multiple clicking on submit?


I am having problem that when i am trying to submit the form by clicking on the submit button it takes some time to post request during this if i am again click on the Submit button it will again send the all parameters and parametrs get saved twice, thrice ....so on.

I don't know how to limit the the submit button so that form shouldn't get submitted twice. I think when i cliked on submit i have to disable submit button so that user can't click it again, is it right approach to doing this?


Solution

  • <input type="submit" onclick="this.disabled = true" value="Save"/>