mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 09:04:53 +01:00
Handle inputs with names ending in [] as arrays
This commit is contained in:
parent
7f57f28f38
commit
1dc6376ed4
@ -315,10 +315,11 @@ etemplate2.prototype.getValues = function(_root)
|
||||
|
||||
// check if id contains a hierachical name, eg. "button[save]"
|
||||
var id = _widget.id;
|
||||
var indexes = _widget.id.split('[',2); // Discards the others
|
||||
var indexes = id.split('[');
|
||||
if (indexes.length > 1)
|
||||
{
|
||||
indexes[1] = _widget.id.substring(indexes[0].length+1, _widget.id.length-1); // Add the rest back in, less the trailing ]
|
||||
indexes = [indexes.shift(), indexes.join('[')];
|
||||
indexes[1] = indexes[1].substring(0,indexes[1].length-1);
|
||||
var children = indexes[1].split('][');
|
||||
if(children.length)
|
||||
{
|
||||
@ -351,6 +352,12 @@ etemplate2.prototype.getValues = function(_root)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle arrays, eg radio[]
|
||||
if(id === "")
|
||||
{
|
||||
id = typeof target == "undefined" ? 0 : _target.length;
|
||||
}
|
||||
|
||||
// Check whether the entry is really undefined
|
||||
if (typeof _target[id] != "undefined")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user