forked from DubFriend/jquery.repeater
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes DubFriend#13 (Retrieve repeater data without form submit)
- Loading branch information
Brian Detering
authored and
Brian Detering
committed
Nov 7, 2015
1 parent
2d3868f
commit 3a3e4b5
Showing
6 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// jquery.repeater version 1.1.0 | ||
// jquery.repeater version 1.1.2 | ||
// https://github.com/DubFriend/jquery.repeater | ||
// (MIT) 07-11-2015 | ||
// Brian Detering <[email protected]> (http://www.briandetering.net/) | ||
|
@@ -697,6 +697,33 @@ $.fn.inputClear = function () { | |
|
||
}(jQuery)); | ||
|
||
$.fn.repeaterVal = function () { | ||
var rawData = $(this).inputVal(); | ||
var mapped = {}; | ||
|
||
foreach(rawData, function (val, key) { | ||
var group, index, name; | ||
var matches; | ||
if(key !== "undefined") { | ||
matches = key.match(/^([^\[]+)\[([0-9]+)\]\[([^\]]+)/); | ||
group = matches[1]; | ||
index = matches[2]; | ||
name = matches[3]; | ||
if(!mapped[group]) { | ||
mapped[group] = []; | ||
} | ||
|
||
if(!mapped[group][index]) { | ||
mapped[group][index] = {}; | ||
} | ||
|
||
mapped[group][index][name] = val; | ||
} | ||
}); | ||
|
||
return mapped; | ||
}; | ||
|
||
$.fn.repeater = function(fig) { | ||
fig = fig || {}; | ||
|
||
|
@@ -802,6 +829,7 @@ $.fn.repeater = function(fig) { | |
}); | ||
}); | ||
|
||
|
||
}); | ||
|
||
return this; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters