LSform.js : add method getInput() and use it in method getValue()
authorBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 15:31:40 +0000 (17:31 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 15:31:40 +0000 (17:31 +0200)
public_html/includes/js/LSform.js

index f7bafd6..21d8464 100644 (file)
@@ -178,6 +178,17 @@ var LSform = new Class({
     
     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 ul = $(fieldName);
       if ($type(ul)) {
         var elements = ul.getElements('input');
@@ -190,11 +201,7 @@ var LSform = new Class({
           LSdebug(name);
           if (name) {
             if (name[1]==fieldName) {
-              if ($type(el.value)) {
-                if (el.value!="") {
-                  retVal.include(el.value);
-                }
-              }
+              retVal.include(el);
             }
           }
         },this);