Rails : Changing submit button text just before form is submitted, disable_with: ‘Saving …’

The disable_with atttribute is a part of Rails Unobtrusive JS features. If you keep this attribute, you need to add jquery_ujs library in you asset_precompilation list. like

// In application.js file
//= jquery_ujs
<div class="btn-action">
      <%= f.submit "Save", class: 'btn-blue', :disable_with => "Saving..." %>
      <%= f.submit "Save and Email", class: 'btn-blue', :disable_with => "Sending Email..." %>
</div>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s