disable-with on ajax forms when file is present #231

Closed
assembler opened this Issue Dec 23, 2011 · 1 comment

Comments

Projects
None yet
3 participants

If the ajax form has file field, it will fall-back to standard POST,
but when it does, it does not disables the submit button with "data-disable-with" attribute

https://github.com/rails/jquery-ujs/blob/master/src/rails.js#L337

I'm using this piece of coffee in order to make it work in my app:

$('form').live 'ajax:aborted:file', (event, elements) ->
  $submit = $(this).find('input[type=submit]')
  if $submit.data('disable-with')
    $submit.prop 'disabled', true
    $submit.attr 'value', $submit.data('disable-with')
  true

Shouldn't this be working out of the box?

Any update on this issue? I too was surprised that this did not work out of the box. Seems silly to have to write some custom javascript around this problem.

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