rails/jquery-ujs — Issue #231: disable-with on ajax forms when file is present
Author: assembler
Created: 2011-12-23 14:21:43+00:00
State: open

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?