* Create a new DateField
* @param {Object} config
*/
-Roo.form.DateField = function(config){
+Roo.form.DateField = function(config)
+{
Roo.form.DateField.superclass.constructor.call(this, config);
this.addEvents({
});
- if(typeof this.minValue == "string") this.minValue = this.parseDate(this.minValue);
- if(typeof this.maxValue == "string") this.maxValue = this.parseDate(this.maxValue);
+ if(typeof this.minValue == "string") {
+ this.minValue = this.parseDate(this.minValue);
+ }
+ if(typeof this.maxValue == "string") {
+ this.maxValue = this.parseDate(this.maxValue);
+ }
this.ddMatch = null;
if(this.disabledDates){
var dd = this.disabledDates;
var re = "(?:";
for(var i = 0; i < dd.length; i++){
re += dd[i];
- if(i != dd.length-1) re += "|";
+ if(i != dd.length-1) {
+ re += "|";
+ }
}
this.ddMatch = new RegExp(re + ")");
}
{
Roo.form.DateField.superclass.onRender.call(this, ct, position);
if (this.useIso) {
- this.el.dom.removeAttribute('name');
+ //this.el.dom.removeAttribute('name');
+ Roo.log("Changing name?");
+ this.el.dom.setAttribute('name', this.name + '____hidden___' );
this.hiddenField = this.el.insertSibling({ tag:'input', type:'hidden', name: this.name },
'before', true);
this.hiddenField.value = this.value ? this.formatDate(this.value, 'Y-m-d') : '';
{
value = this.formatDate(value);
if(!Roo.form.DateField.superclass.validateValue.call(this, value)){
+ Roo.log('super failed');
return false;
}
if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
var svalue = value;
value = this.parseDate(value);
if(!value){
+ Roo.log('parse date failed' + svalue);
this.markInvalid(String.format(this.invalidText, svalue, this.format));
return false;
}
validateBlur : function(){
return !this.menu || !this.menu.isVisible();
},
+
+ getName: function()
+ {
+ // returns hidden if it's set..
+ if (!this.rendered) {return ''};
+ return !this.hiddenName && this.el.dom.name ? this.el.dom.name : (this.hiddenName || '');
+
+ },
/**
* Returns the current date value of the date field.
return value;
}
var v = Date.parseDate(value, this.format);
- if (this.useIso) {
+ if (!v && this.useIso) {
v = Date.parseDate(value, 'Y-m-d');
}
if(!v && this.altFormats){
// private
menuListeners : {
select: function(m, d){
- Roo.log("menuListeners select");
this.setValue(d);
this.fireEvent('select', this, d);
if(v){
this.setValue(v);
}
- }
+ },
- /** @cfg {Boolean} grow @hide */
- /** @cfg {Number} growMin @hide */
- /** @cfg {Number} growMax @hide */
- /**
- * @hide
- * @method autoSize
+ /*@
+ * overide
+ *
*/
+ isDirty : function() {
+ if(this.disabled) {
+ return false;
+ }
+
+ if(typeof(this.startValue) === 'undefined'){
+ return false;
+ }
+
+ return String(this.getValue()) !== String(this.startValue);
+
+ },
+ // @overide
+ cleanLeadingSpace : function(e)
+ {
+ return;
+ }
+
});
\ No newline at end of file