Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Commit button disable_with option #466

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

dbackeus commented Dec 9, 2010

Rails supports :disable_with => "Text to display on button while submitting..." as an option to the form.submit and submit_tag methods.

This implementation is the same as is used in Rails 3 and hooks in to the rails.js stuff just fine.

Probably not compatible with old school non unobtrusive Rails 2 stuff though.

Owner

justinfrench commented Dec 12, 2010

I'm going to sit on this until we drop 2.x support (which is actually really soon).

Collaborator

sobrinho commented Mar 13, 2011

Closing.

Currently this works on input_html:

f.commit_button :button_html => { :disable_with => 'Aguarde...' }
Contributor

dbackeus commented Mar 14, 2011

Ok that's cool. A statement about it in the docs would help though as this is quite obscure.

Owner

justinfrench commented Mar 14, 2011

@dbackeus :button_html is briefly mentioned in the README and well documented in the refactor I'm doing (see Formtastic::Helpers::ButtonsHelper and #commit_button in master). If you think anything further will be needed, would love a patch or even specific suggestions in this thread will do. Documentation is a big deal to me in v2.

Contributor

dbackeus commented Mar 14, 2011

Well, optimally I would still implement the :disable_with option and just provide an example with that in the README. Keeping in mind the "principle of least surprise" design we're used to in Ruby. If it works in Rails I hope it to work the same way in Formtastic.

Especially given that going the route of :button_html => { :data-disable-with => "xxx" } requires knowledge about the implementation details of what Rails actually does when using the disable_with option.

But if you keep it that way adding that option to your existing commit_button example in the README would probably suffice. Allowing people to find it through cmd+f with "disable" in their browser / text-editor (which is how I usually go about finding this kind of stuff).

Owner

justinfrench commented Mar 25, 2011

Re-opening until this can be made clear.

@justinfrench justinfrench reopened this Mar 25, 2011

Owner

justinfrench commented May 4, 2011

I've added documentation as suggested. We're toying with the idea of moving all the input_html / button_html options up to the same namespace as the options, which would ultimately result in the same API as what your patch was aiming for.

Contributor

dbackeus commented May 5, 2011

I believe the example in the documentation is incorrect. The class should be data-disable-with and not disable_with.

Thus also remaining incompatible with the Rails api even if you flatten out the namespacing (which doesn't sound like a bad idea to me btw).

@sodabrew sodabrew referenced this pull request in mjbellantoni/formtastic-bootstrap Jun 19, 2013

Closed

Add data-disable-with attributes if found in i18n. #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment