Roo/form/ComboBoxArray.js
[roojs1] / Roo / form / ComboBoxArray.js
index 8ad46f9..9dcdfed 100644 (file)
@@ -335,6 +335,17 @@ Roo.extend(Roo.form.ComboBoxArray, Roo.form.TextField,
         
     },
     
+    /**
+     * Validates the combox array value
+     * @return {Boolean} True if the value is valid, else false
+     */
+    validate : function(){
+        if(this.disabled || this.validateValue(this.processValue(this.getValue()))){
+            this.clearInvalid();
+            return true;
+        }
+        return false;
+    },
     
     validateValue : function(value){
         return Roo.form.ComboBoxArray.superclass.validateValue.call(this, this.getValue());
@@ -418,17 +429,29 @@ Roo.extend(Roo.form.ComboBoxArray.Item, Roo.BoxComponent, {
         this.cb.updateHiddenEl();
     },
     
-    /**
-     * Validates the combox array value
-     * @return {Boolean} True if the value is valid, else false
+    /*@
+     * overide
+     * 
      */
-    validate : function(){
-        if(this.disabled || this.validateValue(this.processValue(this.getValue()))){
-            this.clearInvalid();
-            return true;
+    isDirty : function() {
+        if(this.disabled) {
+            return false;
         }
-        return false;
+        
+        try {
+            var d = Roo.decode(String(this.originalValue));
+        } catch (e) {
+            return String(this.getValue()) !== String(this.originalValue);
+        }
+        
+        var originalValue = [];
+        
+        for (var i = 0; i < d.length; i++){
+            originalValue.push(d[i][this.valueField]);
+        }
+        
+        return String(this.getValue()) !== String(originalValue.join(','));
+        
     }
     
-    
 });
\ No newline at end of file