diff --git a/web/javascript/jquery/jquery.form.js b/web/javascript/jquery/jquery.form.js index 0801fa5f7..fdcdd15ac 100644 --- a/web/javascript/jquery/jquery.form.js +++ b/web/javascript/jquery/jquery.form.js @@ -1,6 +1,6 @@ /*! * jQuery Form Plugin - * version: 2.75 (20-MAY-2011) + * version: 2.84 (12-AUG-2011) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ @@ -49,13 +49,16 @@ $.fn.ajaxSubmit = function(options) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } + + var method, action, url, $form = this; if (typeof options == 'function') { options = { success: options }; } - var action = this.attr('action'); - var url = (typeof action === 'string') ? $.trim(action) : ''; + method = this.attr('method'); + action = this.attr('action'); + url = (typeof action === 'string') ? $.trim(action) : ''; url = url || window.location.href || ''; if (url) { // clean url (don't include hash vaue) @@ -65,7 +68,7 @@ $.fn.ajaxSubmit = function(options) { options = $.extend(true, { url: url, success: $.ajaxSettings.success, - type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57) + type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); @@ -88,7 +91,7 @@ $.fn.ajaxSubmit = function(options) { if (options.data) { options.extraData = options.data; for (n in options.data) { - if(options.data[n] instanceof Array) { + if( $.isArray(options.data[n]) ) { for (var k in options.data[n]) { a.push( { name: n, value: options.data[n][k] } ); } @@ -124,7 +127,7 @@ $.fn.ajaxSubmit = function(options) { options.data = q; // data is the query string for 'post' } - var $form = this, callbacks = []; + var callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } @@ -162,13 +165,19 @@ $.fn.ajaxSubmit = function(options) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { - $.get(options.closeKeepAlive, fileUpload); + $.get(options.closeKeepAlive, function() { fileUpload(a); }); } else { - fileUpload(); + fileUpload(a); } } else { + // IE7 massage (see issue 57) + if ($.browser.msie && method == 'get') { + var ieMeth = $form[0].getAttribute('method'); + if (typeof ieMeth === 'string') + options.type = ieMeth; + } $.ajax(options); } @@ -178,8 +187,17 @@ $.fn.ajaxSubmit = function(options) { // private function for handling file uploads (hat tip to YAHOO!) - function fileUpload() { - var form = $form[0]; + function fileUpload(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var useProp = !!$.fn.prop; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < a.length; i++) { + el = $(form[a[i].name]); + el[ useProp ? 'prop' : 'attr' ]('disabled', false); + } + } if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be @@ -188,15 +206,25 @@ $.fn.ajaxSubmit = function(options) { return; } - var s = $.extend(true, {}, $.ajaxSettings, options); + s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; - var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; - var $io = $('