From d9275d53d036edc38e63c090ac265c5f2e6d4dfc Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 30 Mar 2012 19:42:01 +0000 Subject: [PATCH] Avoid sending back empty sub-arrays - apps that check for their presence, not contents, have trouble with them --- etemplate/js/etemplate2.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 92837d5e09..0471c0cf1a 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -372,6 +372,16 @@ etemplate2.prototype.getValues = function(_root) { _target[id] = value; } + else if (jQuery.isEmptyObject(_target)) + { + // Avoid sending back empty sub-arrays + _target = result + for (var i = 0; i < path.length-1; i++) + { + _target = _target[path[i]]; + } + delete _target[path[path.length-1]]; + } _widget.resetDirty(); }, this, et2_IInput);