LSform.js : add method getInput() and use it in method getValue()

This commit is contained in:
Benjamin Renard 2014-06-17 17:31:40 +02:00
parent 33cef8be28
commit e58be43126

View file

@ -177,6 +177,17 @@ var LSform = new Class({
}, },
getValue: function(fieldName) { getValue: function(fieldName) {
var retVal = Array();
var inputs = this.getInput(fieldName);
inputs.each(function(el){
if (el.value!="") {
retVal.include(el.value);
}
},this);
return retVal;
},
getInput: function(fieldName) {
var retVal = Array(); var retVal = Array();
var ul = $(fieldName); var ul = $(fieldName);
if ($type(ul)) { if ($type(ul)) {
@ -190,11 +201,7 @@ var LSform = new Class({
LSdebug(name); LSdebug(name);
if (name) { if (name) {
if (name[1]==fieldName) { if (name[1]==fieldName) {
if ($type(el.value)) { retVal.include(el);
if (el.value!="") {
retVal.include(el.value);
}
}
} }
} }
},this); },this);