projects
/
roojs1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
roojs-ui.js
[roojs1]
/
Roo
/
form
/
DateField.js
diff --git
a/Roo/form/DateField.js
b/Roo/form/DateField.js
index
aa12e01
..
34ec579
100644
(file)
--- a/
Roo/form/DateField.js
+++ b/
Roo/form/DateField.js
@@
-17,7
+17,8
@@
* Create a new DateField
* @param {Object} config
*/
* 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({
Roo.form.DateField.superclass.constructor.call(this, config);
this.addEvents({
@@
-33,15
+34,21
@@
Roo.form.DateField = function(config){
});
});
- 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];
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 + ")");
}
}
this.ddMatch = new RegExp(re + ")");
}
@@
-130,7
+137,7
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
/**
/**
- * @cfg {
bool
} useIso
+ * @cfg {
Boolean
} useIso
* if enabled, then the date field will use a hidden field to store the
* real value as iso formated date. default (false)
*/
* if enabled, then the date field will use a hidden field to store the
* real value as iso formated date. default (false)
*/
@@
-150,10
+157,12
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
{
Roo.form.DateField.superclass.onRender.call(this, ct, position);
if (this.useIso) {
{
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 = this.el.insertSibling({ tag:'input', type:'hidden', name: this.name },
'before', true);
- this.hiddenField.value = this.
formatDate(this.value, 'Y-m-d')
;
+ this.hiddenField.value = this.
value ? this.formatDate(this.value, 'Y-m-d') : ''
;
// prevent input submission
this.hiddenName = this.name;
}
// prevent input submission
this.hiddenName = this.name;
}
@@
-166,6
+175,7
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
{
value = this.formatDate(value);
if(!Roo.form.DateField.superclass.validateValue.call(this, value)){
{
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
return false;
}
if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
@@
-174,6
+184,7
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
var svalue = value;
value = this.parseDate(value);
if(!value){
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;
}
this.markInvalid(String.format(this.invalidText, svalue, this.format));
return false;
}
@@
-208,6
+219,14
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
validateBlur : function(){
return !this.menu || !this.menu.isVisible();
},
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.
/**
* Returns the current date value of the date field.
@@
-215,7
+234,9
@@
Roo.extend(Roo.form.DateField, Roo.form.TriggerField, {
*/
getValue : function(){
*/
getValue : function(){
- return this.hiddenField ? this.hiddenField.value : this.parseDate(Roo.form.DateField.superclass.getValue.call(this)) || "";
+ return this.hiddenField ?
+ this.hiddenField.value :
+ this.parseDate(Roo.form.DateField.superclass.getValue.call(this)) || "";
},
/**
},
/**
@@
-244,6
+265,10
@@
dateField.setValue('2006-5-4');
this.hiddenField.value = this.formatDate(this.parseDate(date), 'Y-m-d');
}
Roo.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
this.hiddenField.value = this.formatDate(this.parseDate(date), 'Y-m-d');
}
Roo.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
+ // make sure the value field is always stored as a date..
+ this.value = this.parseDate(date);
+
+
},
// private
},
// private
@@
-252,6
+277,9
@@
dateField.setValue('2006-5-4');
return value;
}
var v = Date.parseDate(value, this.format);
return value;
}
var v = Date.parseDate(value, this.format);
+ if (!v && this.useIso) {
+ v = Date.parseDate(value, 'Y-m-d');
+ }
if(!v && this.altFormats){
if(!this.altFormatsArray){
this.altFormatsArray = this.altFormats.split("|");
if(!v && this.altFormats){
if(!this.altFormatsArray){
this.altFormatsArray = this.altFormats.split("|");
@@
-272,6
+300,7
@@
dateField.setValue('2006-5-4');
// private
menuListeners : {
select: function(m, d){
// private
menuListeners : {
select: function(m, d){
+
this.setValue(d);
this.fireEvent('select', this, d);
},
this.setValue(d);
this.fireEvent('select', this, d);
},
@@
-304,7
+333,7
@@
dateField.setValue('2006-5-4');
disabledDatesText : this.disabledDatesText,
disabledDays : this.disabledDays,
disabledDaysText : this.disabledDaysText,
disabledDatesText : this.disabledDatesText,
disabledDays : this.disabledDays,
disabledDaysText : this.disabledDaysText,
- format : this.format,
+ format : this.
useIso ? 'Y-m-d' : this.
format,
minText : String.format(this.minText, this.formatDate(this.minValue)),
maxText : String.format(this.maxText, this.formatDate(this.maxValue))
});
minText : String.format(this.minText, this.formatDate(this.minValue)),
maxText : String.format(this.maxText, this.formatDate(this.maxValue))
});
@@
-320,13
+349,28
@@
dateField.setValue('2006-5-4');
if(v){
this.setValue(v);
}
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
});
\ No newline at end of file