Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The problem of :disable_with #30

Closed
inetufo opened this issue Oct 8, 2010 · 22 comments
Closed

The problem of :disable_with #30

inetufo opened this issue Oct 8, 2010 · 22 comments

Comments

@inetufo
Copy link

inetufo commented Oct 8, 2010

My code is below:

<%= f.submit "submit", :class => "submit", :disable_with => "waiting..." %>

In IE8 Using jquery1.4.1, when i clicked the button to submit,it really was disabled, but the http request wasn't posted, so the "create" action isn't called. Using jquery1.4.2,http request is posted,but the button isn't disabled.This works fine in firefox.I don't know why...

@inetufo
Copy link
Author

inetufo commented Oct 21, 2010

Where is the author.Please have a look

@modsognir
Copy link

I am having this issue too with IE8 and jquery 1.4.3. Button disables but doesn't submit.

@inetufo
Copy link
Author

inetufo commented Oct 25, 2010

Look at this issue http://github.com/rails/jquery-ujs/issues#issue/33
I've found a way to solve it without knowing the reason

@modsognir
Copy link

.live seems to be an issue with IE8 in a few versions of jquery it seems. .bind is similar but I dont know what kind of effect it will have changing it, seemingly none from my testing.

@inetufo
Copy link
Author

inetufo commented Oct 26, 2010

jquery 1.4.3 is the same as jquery1.4.1

@neerajsingh0101
Copy link

This is jQuery issue. Take a look at http://bugs.jquery.com/ticket/7061 .

@jobstar-se
Copy link

it seems easy to provide a workaround while we are waiting for the jquery fix. just call disable_with_input_function and enable from within the callRemote function. i have already fixed this in my version. i can provide the patch if you like.

i think it is cleaner to have the enable code refactored into its own function anyway like disable_with_input_function.

my fix also solves the problem that if you have remote link_to elements in a form the buttons in the form are disabled but never enabled (tested on chrome and firefox).

@neerajsingh0101
Copy link

Yes please do submit the patch. If possible add tests too. Thanks.

@simmerz
Copy link

simmerz commented Dec 11, 2010

This isn't just an IE8 issue. Seems to be a problem in 1.4.4 Firefox too.

@cracell
Copy link

cracell commented Jan 12, 2011

If IE8 and IE7 are supported it needs to be fixed or disable_with needs to be disabled until it can be fixed. Or listing it on the Readme as a known issue until it can be resolved.

I was able to get it working by replacing several of the lives with binds, which unfortunately loses the live functionality so it not a suitable patch. (I'm using jQuery 1.4.4)

@inspire22
Copy link

Has this been fixed yet for IE?

@zilkey
Copy link

zilkey commented Feb 10, 2011

I just downloaded jquery 5 and it's still a bug. However, it only seems to be a bug for synchronous form posts - it works perfectly well if you form is data-remote=true.

I decided that it was worth it for me to just turn off the disable behavior in IE for non-ajax forms, so I added this clause to disableFormElements as a temporary work-around:

if($.browser.msie && !form.is("[data-remote=true]")){
  return;
}

So the whole function is:

function disableFormElements(form) {
  if($.browser.msie && !form.is("[data-remote=true]")){
    return;
  }
  form.find('input[data-disable-with]').each(function() {
    var input = $(this);
    input.data('ujs:enable-with', input.val())
      .val(input.attr('data-disable-with'))
      .attr('disabled', 'disabled');
  });
}

So while it doesn't solve the problem, it limits it to synchronous IE posts, and all other browsers and IE ajax posts still get goodness.

@mislav
Copy link
Member

mislav commented Feb 10, 2011

I can't reproduce this. Can you guys check the latest rails.js against jQuery 1.4.3 or newer? If you get failing results, please submit more details.

@inspire22
Copy link

as of 3 days ago it was broken for me with 1.4.3.

Add a non-remote form tag, 'data-disable-with'='please wait'. Try it in IE - it'll change the submit button to 'please wait' but won't submit the form.

@zilkey
Copy link

zilkey commented Feb 11, 2011

Just tested against jquery 1.5 + IE8 and it worked like a charm! That timeout was clever.

@mislav
Copy link
Member

mislav commented Feb 11, 2011

Closing this issue since the timeout added in 900d714 should fix the problem.

@tekin
Copy link

tekin commented Feb 11, 2011

It appears to still be broken with jquery 1.5 on IE7.

@mislav
Copy link
Member

mislav commented Feb 11, 2011

Can't reproduce this with any version of jQuery (1.4.4, 1.5, edge) and IE7 on WinXp. This is the code I'm using:

<form action="/echo" method="post">
  <p>
    <input type="text" name="name" required>
    <input type="submit" name="submit" value="Send" data-disable-with="Sending…">
  </p>
</form>

Both "name" and "submit" get serialized, the submit button gets disabled, and the form is sent.

@tekin
Copy link

tekin commented Feb 11, 2011

What about when you submit the form by hitting return?

@mislav
Copy link
Member

mislav commented Feb 11, 2011

Still works. There's no reason why it wouldn't; disabling of form buttons is now done asynchronously and can't interfere with submitting of form in any way.

@tekin
Copy link

tekin commented Feb 13, 2011

My apologies, it is indeed working. I think I may have inadvertently tested against the deployed code, which had an older version of rails.js.

@fro
Copy link

fro commented Jun 30, 2011

Same problem here. Thanks to zilkey for the workaround...

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests