class Tao.Form.ElementBase extends TaoComponent @tag 'tao-form' @attribute 'successMessage' _connected: -> @_bind() @jq.find('.input-field[autofocus]').focus() _bind: -> @on 'ajax:beforeSend', '> form', (e) => @_clearErrors() @namespacedTrigger 'beforeSubmit' @on 'ajax:success', '> form', (e) => @_showSuccessMessage() @namespacedTrigger 'success' _disconnected: -> @off() _clearErrors: -> @jq.find('.input-with-errors').each (i, input) => @_clearError input _clearError: (input) -> $(input).removeClass('input-with-errors') .find('.error').remove() _showSuccessMessage: -> return unless @successMessage $button = @jq.find('button[data-disable-with]:disabled, input[data-disable-with]:disabled') $message = $('