|
@@ -49,7 +49,26 @@
|
|
|
}
|
|
|
form.find('[data-name]').each(function() {
|
|
|
if(!parsed) parsed = {};
|
|
|
- parsed[$(this).attr('data-name')] = $(this).val();
|
|
|
+
|
|
|
+ let keys = $(this).attr('data-name').split('->');
|
|
|
+ let currentNode = parsed;
|
|
|
+ for (let i = 0; i < keys.length; i++) {
|
|
|
+ if(i !== keys.length - 1) {
|
|
|
+ if(typeof currentNode[keys[i]] === 'undefined') {
|
|
|
+ currentNode[keys[i]] = {};
|
|
|
+ }
|
|
|
+ currentNode = currentNode[keys[i]];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if($(this).is(':checkbox')) {
|
|
|
+ currentNode[keys[i]] = $(this).prop('checked');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ currentNode[keys[i]] = $(this).val();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
if(parsed) {
|
|
|
dataField.val(JSON.stringify(parsed));
|