* @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
* {tag: "input", type: "text", size: "20", autocomplete: "off"})
*/
- defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},
+ defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "new-password"},
/**
* @cfg {String} fieldClass The default CSS class for the field (defaults to "x-form-field")
*/
/**
* @cfg {String} cls A CSS class to apply to the field's underlying element.
*/
-
+ // private
+ loadedValue : false,
+
+
// private ??
initComponent : function(){
Roo.form.Field.superclass.initComponent.call(this);
/**
* Returns true if this field has been changed since it was originally loaded and is not disabled.
+ * DEPRICATED - it never worked well - use hasChanged/resetHasChanged.
*/
isDirty : function() {
if(this.disabled) {
return String(this.getValue()) !== String(this.originalValue);
},
+ /**
+ * stores the current value in loadedValue
+ */
+ resetHasChanged : function()
+ {
+ this.loadedValue = String(this.getValue());
+ },
+ /**
+ * checks the current value against the 'loaded' value.
+ * Note - will return false if 'resetHasChanged' has not been called first.
+ */
+ hasChanged : function()
+ {
+ if(this.disabled || this.readOnly) {
+ return false;
+ }
+ return this.loadedValue !== false && String(this.getValue()) !== this.loadedValue;
+ },
+
+
+
// private
afterRender : function(){
Roo.form.Field.superclass.afterRender.call(this);
* Resets the current field value to the originally loaded value and clears any validation messages
*/
reset : function(){
- this.setValue(this.originalValue);
+ this.setValue(this.resetValue);
+ this.originalValue = this.getValue();
this.clearInvalid();
},
// reference to original value for reset
this.originalValue = this.getValue();
+ this.resetValue = this.getValue();
},
// private
if(!this.rendered || this.preventMark){ // not rendered
return;
}
- this.el.addClass(this.invalidClass);
+
+ var obj = (typeof(this.combo) != 'undefined') ? this.combo : this; // fix the combox array!!
+
+ obj.el.addClass(this.invalidClass);
msg = msg || this.invalidText;
switch(this.msgTarget){
case 'qtip':
- this.el.dom.qtip = msg;
- this.el.dom.qclass = 'x-form-invalid-tip';
+ obj.el.dom.qtip = msg;
+ obj.el.dom.qclass = 'x-form-invalid-tip';
if(Roo.QuickTips){ // fix for floating editors interacting with DND
Roo.QuickTips.enable();
}
if(!this.rendered || this.preventMark){ // not rendered
return;
}
- this.el.removeClass(this.invalidClass);
+ var obj = (typeof(this.combo) != 'undefined') ? this.combo : this; // fix the combox array!!
+
+ obj.el.removeClass(this.invalidClass);
switch(this.msgTarget){
case 'qtip':
- this.el.dom.qtip = '';
+ obj.el.dom.qtip = '';
break;
case 'title':
this.el.dom.title = '';
if(tag == 'input'){
return w + 2;
}
- if(tag = 'textarea'){
+ if(tag == 'textarea'){
return w-2;
}
}else if(Roo.isOpera){
if(tag == 'input'){
return w + 2;
}
- if(tag = 'textarea'){
+ if(tag == 'textarea'){
return w-2;
}
}