Skip to content

Commit 8914e4b

Browse files
committed
jquery-form#213; Ability to specify multiple fields with the same name on iframe submissions
1 parent 79c1864 commit 8914e4b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

jquery.form.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Form Plugin
3-
* version: 3.12 (20-JUL-2012)
3+
* version: 3.13 (29-JUL-2012)
44
* @requires jQuery v1.3.2 or later
55
*
66
* Examples and documentation at: http://malsup.com/jquery/form/
@@ -433,9 +433,16 @@ $.fn.ajaxSubmit = function(options) {
433433
if (s.extraData) {
434434
for (var n in s.extraData) {
435435
if (s.extraData.hasOwnProperty(n)) {
436-
extraInputs.push(
437-
$('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
438-
.appendTo(form)[0]);
436+
// if using the $.param format that allows for multiple values with the same name
437+
if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
438+
extraInputs.push(
439+
$('<input type="hidden" name="'+s.extraData[n].name+'">').attr('value',s.extraData[n].value)
440+
.appendTo(form)[0]);
441+
} else {
442+
extraInputs.push(
443+
$('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
444+
.appendTo(form)[0]);
445+
}
439446
}
440447
}
441448
}

0 commit comments

Comments
 (0)