Changeset 5359
- Timestamp:
- 04/30/08 00:19:42 (7 months ago)
- Files:
-
- 1 modified
-
trunk/plugins/form/jquery.form.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/form/jquery.form.js
r4860 r5359 1 1 /* 2 2 * jQuery Form Plugin 3 * version: 2.0 7 (03/04/2008)3 * version: 2.08 (04/29/2008) 4 4 * @requires jQuery v1.2.2 or later 5 5 * … … 11 11 * Revision: $Id$ 12 12 */ 13 (function($) { 13 (function($) { 14 14 15 /** 15 16 * ajaxSubmit() provides a mechanism for submitting an HTML form using AJAX. … … 178 179 */ 179 180 $.fn.ajaxSubmit = function(options) { 181 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 182 if (!this.length) { 183 log('ajaxSubmit: skipping submit process - no element selected'); 184 return this; 185 } 186 180 187 if (typeof options == 'function') 181 188 options = { success: options }; … … 190 197 var veto = {}; 191 198 this.trigger('form-pre-serialize', [this, options, veto]); 192 if (veto.veto) return this; 199 if (veto.veto) { 200 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 201 return this; 202 } 193 203 194 204 var a = this.formToArray(options.semantic); … … 200 210 201 211 // give pre-submit callback an opportunity to abort the submit 202 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this; 212 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 213 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 214 return this; 215 } 203 216 204 217 // fire vetoable 'validate' event 205 218 this.trigger('form-submit-validate', [a, this, options, veto]); 206 if (veto.veto) return this; 219 if (veto.veto) { 220 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 221 return this; 222 } 207 223 208 224 var q = $.param(a); … … 867 883 }; 868 884 885 // helper fn for console logging 886 // set $.fn.ajaxSubmit.debug to true to enable debug logging 887 function log() { 888 if ($.fn.ajaxSubmit.debug && window.console && window.console.log) 889 window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,'')); 890 }; 891 869 892 })(jQuery);
