bnabriss/jquery-form-validation

Minified error?

dbryar opened this issue · 1 comments

Uncaught TypeError: this.$form.serializeArrayKv is not a function

Pretty Print lines 209, 216 & 222

I thought maybe this is a function that didn't go through minification too well, but it exists in the full source too on lines 233, 239 & 245.

I replaced the function .serializeArrayKv with .serializeObject using this code from https://stackoverflow.com/questions/11376184/jquery-serializearray-key-value-pairs/12399106

/*!
 * jQuery serializeObject - v0.2 - 1/20/2010
 * http://benalman.com/projects/jquery-misc-plugins/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */

// Whereas .serializeArray() serializes a form into an array, .serializeObject()
// serializes a form into an (arguably more useful) object.

(function($,undefined){
  '$:nomunge'; // Used by YUI compressor.

  $.fn.serializeObject = function(){
    var obj = {};

    $.each( this.serializeArray(), function(i,o){
      var n = o.name,
        v = o.value;

        obj[n] = obj[n] === undefined ? v
          : $.isArray( obj[n] ) ? obj[n].concat( v )
          : [ obj[n], v ];
    });

    return obj;
  };

})(jQuery);

Thanks for your solution, I've a similar one.
I have missed that function, fixed.