Simple_form: :disable_with option is not working

Created on 9 Aug 2012  路  10Comments  路  Source: heartcombo/simple_form

:disable_with option is not working in submit button.here is code

   f.submit 'Start Your Membership', :class => 'button', :disable_with => 'Please Wait...'

and generated markup

<input class="button" data-disable-with="Please Wait..." id="user_submit" name="commit" type="submit" value="Start Your Membership">

I'm using rails (3.0.7) and simple_form (2.0.2)

Most helpful comment

I have fixed this with adding data options

f.submit 'Start Your Membership', :class => 'button', :data => {:disable_with => 'Please Wait...'}

Hopefully it help everyone.

All 10 comments

@naveed-ahmad SimpleForm do nothing with this feature, it's from jquery-rails gem. If you have data-disabled-with on your input actually everything should work. Are you sure you have jquery-rails gem in your Gemfile?

I'm closing this since it is not a SimpleForm issue. The generated markup is correct.

You need to add jquery and jquery-ujs javascripts to your application.

@naveed-ahmad I have the same issue but I noticed that is a problem only with Safari 6.0. Works fine in Chrome and Firefox.

@bkzl I'm getting this issue with Safari 6 as well, do you know of a workaround? When I call the following in Safari console it works- not sure what's going on.

$.rails.disableFormElements($('form.simple_form')); 

@rheaton I gave up

@bkzl Ah, thanks for getting back to me so quickly. If I come up with something, I will let you know.

Here is the jQuery UJS issue tracking this: https://github.com/rails/jquery-ujs/issues/306

I have fixed this with adding data options

f.submit 'Start Your Membership', :class => 'button', :data => {:disable_with => 'Please Wait...'}

Hopefully it help everyone.

@akbarbin ,thank you, it's very helpful

Was this page helpful?
0 / 5 - 0 ratings