Bug Tracker

Ticket #3494: disable_with.diff

File disable_with.diff, 840 bytes (added by esad, 11 years ago)

Implementation of disableWith option

  • jquery.form.js

     
    105105        options.data = q; // data is the query string for 'post'
    106106
    107107    var $form = this, callbacks = [];
     108    if (options.disableWith) {
     109      var submitButton = this.find('input[@type=submit]');
     110      var submitButtonOldValue = submitButton.attr('value');
     111      options.complete = function() {
     112        submitButton.attr('value',submitButtonOldValue).attr('disabled',false);
     113      }
     114      submitButton.attr('value',options.disableWith).attr('disabled',true).blur();
     115    }
    108116    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    109117    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });
    110118