Commit 355af1d4 authored by Thimo Kraemer's avatar Thimo Kraemer

getFormVar: check for element type before array-like

parent 720dc1ca
......@@ -2029,29 +2029,12 @@ kss.setSessionVars = function(values) {
};
kss.getFormVar = function(element) {
var value;
if (kss.isArrayLike(element)) {
var arr = [];
kss.each(element, function(el) {
value = kss.getFormVar(el);
if (!(value instanceof Array)) {
value = [value];
}
kss.each(value, function (v) {
if (v !== null) {
arr.push(v);
}
});
});
if (!arr.length) {
return null;
}
return arr.length == 1 ? arr[0] : arr;
}
if (element.disabled) {
return null;
}
switch (element.tagName.toLowerCase()) {
var value;
var tagName = element.tagName || '';
switch (tagName.toLowerCase()) {
case 'input':
switch (element.type) {
case 'text':
......@@ -2078,6 +2061,24 @@ kss.getFormVar = function(element) {
}
return element.value;
}
if (kss.isArrayLike(element)) {
var arr = [];
kss.each(element, function(el) {
value = kss.getFormVar(el);
if (!(value instanceof Array)) {
value = [value];
}
kss.each(value, function (v) {
if (v !== null) {
arr.push(v);
}
});
});
if (!arr.length) {
return null;
}
return arr.length == 1 ? arr[0] : arr;
}
value = element.value;
if (typeof value == 'undefined') {
kss.warn('Not a form element!');
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment