I want to change to state of the submit button when a user clicks on that I want to make these transitions on that button.
Text change to "submitting..." and state of that submit button becomes "disabled"
I know how to do this with Jquery something like:
Let's say that the button has a #derp id.
$("#derp").click(function(){
this.toggleClass("pressed");
});
Basicly this will add or remove the "pressed" class from the item based on its state. Just add the css for .pressed and you're ready to go.
#derp {...}
#derp:hover {...}
#derp:active {...}
#derp.pressed {...}
Or we do using different selectors.
Question: Is there is default functionality in ruby on rails.
Update: I am using ajax based form submission and when i try to click 2-3 times form submittion quickly. Its actually submitted 2-3 times. I want to prevent that thing and I am using simple_form
<%= f.button :submit, "Submit Review", :disable_with => "Processing..." %>
To make :disable_with Work with Ajax Remote You have to edit your public/javascripts/rails.js and change
document.on("ajax:after", "form", function(event, element) {
to
document.on("ajax:complete", "form", function(event, element) {