diff --git a/CHANGELOG b/CHANGELOG index dd8e961..52b0636 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ *SVN* -* Add optional third parameter "camlized" to Element.setStyle, for optimized performance if style names are known to be camelCased. [Thomas Fuchs] +* Fix an issue with serializing empty array inputs, fixes #7516. [stakadush, Mislav Marohnić] + +* Add optional third parameter "camelized" to Element.setStyle, for optimized performance if style names are known to be camelCased. [Thomas Fuchs] * Fix a bug in the simulated hasAttribute for IE due to getAttributeNode sometimes returning null. [sam] diff --git a/src/form.js b/src/form.js index 13b7929..54a271d 100644 --- a/src/form.js +++ b/src/form.js @@ -8,8 +8,8 @@ var Form = { var data = elements.inject({}, function(result, element) { if (!element.disabled && element.name) { var key = element.name, value = $(element).getValue(); - if (value != undefined) { - if (result[key]) { + if (value != null) { + if (key in result) { if (result[key].constructor != Array) result[key] = [result[key]]; result[key].push(value); } diff --git a/test/unit/form.html b/test/unit/form.html index 01be2fc..e58afca 100644 --- a/test/unit/form.html +++ b/test/unit/form.html @@ -66,6 +66,14 @@ +
+