LSformElement_text : use getValue/getInput of LSform object instead of LSformElement_...
authorBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 15:33:03 +0000 (17:33 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Tue, 17 Jun 2014 15:33:03 +0000 (17:33 +0200)
public_html/includes/js/LSformElement_text.js
public_html/includes/js/LSformElement_text_field.js

index f457da2..7116fc2 100644 (file)
@@ -51,14 +51,6 @@ var LSformElement_text = new Class({
         }           
       }
       return retval;
-    },
-    
-    getInput: function(name) {
-      return this.elements[name][0].getInput();
-    },
-    
-    getValue: function(name) {
-      return this.elements[name][0].getValue();
     }
     
 });
index 2021ffc..49e1528 100644 (file)
@@ -42,8 +42,12 @@ var LSformElement_text_field = new Class({
           if (((this.isCreation)&&(this.params.autoGenerateOnCreate))||(force)) {
             this.dependsFields = this.parent.getDependsFields(this.format);
             this.dependsFields.each(function(el) {
-              var input = this.parent.getInput.bind(this.parent)(el);
-              input.addEvent('change',this.refreshValue.bind(this));
+              var inputs = varLSform.getInput.bind(this.parent)(el);
+              if (inputs.lenght>0) {
+                inputs.each(function(input) {
+                  input.addEvent('change',this.refreshValue.bind(this));
+                },this);
+              }
             },this);
           }
           this._start=true;
@@ -51,20 +55,12 @@ var LSformElement_text_field = new Class({
       }
     },
     
-    getInput: function() {
-      return this.input;
-    },
-    
-    getValue: function() {
-      return this.input.value;
-    },
-    
     refreshValue: function(force) {
       if (force==true) {
         this._auto=1;
       }
       if (((this._auto)||(force==true))&&((this.generatedValue=="")||(this.generatedValue==this.input.value)||(force==true))) {
-        var val=getFData(this.format,this.parent,'getValue');
+        var val=getFData(this.format,varLSform,'getValue');
         if ($type(this.params['withoutAccent'])) {
           if(this.params['withoutAccent']) {
             val = replaceAccents(val);