Roo/form/TextField.js
authorAlan Knowles <alan@roojs.com>
Wed, 5 Jun 2013 07:05:40 +0000 (15:05 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 5 Jun 2013 07:05:40 +0000 (15:05 +0800)
Roo/form/TextField.js

index 4cee882..09d76b9 100644 (file)
@@ -320,9 +320,17 @@ Roo.extend(Roo.form.TextField, Roo.form.Field,  {
         if(this.el.dom.selectionEnd > 0){
             isSelectAll = (this.el.dom.selectionEnd - this.el.dom.selectionStart - this.getValue().length == 0) ? true : false;
         }
-        if(((event.getKey() == 8 || event.getKey() == 46) && this.getValue().length ==1) || isSelectAll){ // backspace and delete key
+        if(((event.getKey() == 8 || event.getKey() == 46) && this.getValue().length ==1)){ // backspace and delete key
             event.preventDefault();
             this.setValue('');
+            return;
+        };
+        if(isSelectAll){ // backspace and delete key
+            event.preventDefault();
+            this.setValue(String.fromCharCode(charCode));
+            return;
         };
+        
+        
     }
 });
\ No newline at end of file