diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 8ad50c5496..706f3f0bc4 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -392,7 +392,7 @@ etemplate2.prototype.submit = function(button, async) // I'm just not sure how. if(button && !values.button) { - values.button = button.id; + values.button = {}; var path = button.getPath(); var target = values; for(var i = 0; i < path.length; i++) @@ -400,7 +400,7 @@ etemplate2.prototype.submit = function(button, async) if(!values[path[i]]) values[path[i]] = {}; target = values[path[i]]; } - if(target != values) + if(target != values || button.id.indexOf('[') != -1 && path.length == 0) { var indexes = button.id.split('['); if (indexes.length > 1) @@ -421,6 +421,10 @@ etemplate2.prototype.submit = function(button, async) target = target[idx]; } } + else if (typeof values.button == 'undefined') + { + values.button = button.id; + } } // Create the request object