*/
regexText : "",
/**
- * @cfg {String} emptyText The default text to display in an empty field (defaults to null).
+ * @cfg {String} emptyText The default text to display in an empty field - placeholder... (defaults to null).
*/
emptyText : null,
/**
emptyClass : 'x-form-empty-field',
// private
- initEvents : function(){
+ initEvents : function()
+ {
+ if (this.emptyText) {
+ this.el.attr('placeholder', this.emptyText);
+ }
+
Roo.form.TextField.superclass.initEvents.call(this);
if(this.validationEvent == 'keyup'){
this.validationTask = new Roo.util.DelayedTask(this.validate, this);
this.on("focus", this.preFocus, this);
if(this.emptyText){
this.on('blur', this.postBlur, this);
- this.applyEmptyText();
+
}
}
if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){
applyEmptyText : function(){
if(this.rendered && this.emptyText && this.getRawValue().length < 1){
- this.setRawValue(this.emptyText);
+
this.el.addClass(this.emptyClass);
}
},
// private
preFocus : function(){
if(this.emptyText){
- if(this.el.dom.value == this.emptyText){
- this.setRawValue('');
- }
+
this.el.removeClass(this.emptyClass);
}
if(this.selectOnFocus){
* @return {Boolean} True if the value is valid, else false
*/
validateValue : function(value){
- if(value.length < 1 || value === this.emptyText){ // if it's blank
+ if(value.length < 1) { // if it's blank
if(this.allowBlank){
this.clearInvalid();
return true;