GordS
05-17-2010, 11:30 AM
I have a date field in my database that is set to 0001-01-01. This date field is optional. When it displays on the web page it shows as 01/01/1901. I want it to show as a blank field. Otherwise if the user does not want to put a date in the field they get an error message and they will manually have to clear the field. My first attempt to clear the field is shown below but it does not work.
if (data.SUCCESS == '1'){
Ext.getCmp('edit_ACCMNTDATE').setValue(data.ACCMNT DATE);
Ext.getCmp('edit_ACCOMMENTS').setValue(data.ACCOMM ENTS);
Ext.getCmp('edit_ACRMNRDATE').setValue(data.ACRMNR DATE);
if (Ext.getCmp('edit_ACRMNRDATE').getValue() == '0001-01-01') {Ext.getCmp('edit_ACRMNRDATE').setValue('')};
Ext.getCmp('edit_ACEMAILADR').setValue(data.ACEMAI LADR);
},{
xtype:'datefield',
id:'edit_ACRMNRDATE',
autoCreate:{
tag:'input',
maxlength:'10'
},
fieldLabel:'Reminder Date'
I have used similiar logic elsewhere with success. I am not sure what is wrong here.
if (data.SUCCESS == '1'){
Ext.getCmp('edit_ACCMNTDATE').setValue(data.ACCMNT DATE);
Ext.getCmp('edit_ACCOMMENTS').setValue(data.ACCOMM ENTS);
Ext.getCmp('edit_ACRMNRDATE').setValue(data.ACRMNR DATE);
if (Ext.getCmp('edit_ACRMNRDATE').getValue() == '0001-01-01') {Ext.getCmp('edit_ACRMNRDATE').setValue('')};
Ext.getCmp('edit_ACEMAILADR').setValue(data.ACEMAI LADR);
},{
xtype:'datefield',
id:'edit_ACRMNRDATE',
autoCreate:{
tag:'input',
maxlength:'10'
},
fieldLabel:'Reminder Date'
I have used similiar logic elsewhere with success. I am not sure what is wrong here.