PDA

View Full Version : How to disable days in calendar......



ajax&me
5 Mar 2008, 7:50 AM
Hi,

Can somebody help me how to disable all the dates in every month except day one of the month like ["01/01/2008","01/02/2008" -- needs to be enabled ]

I am using below method to disable weekends of every month




function datePicker(fieldName) {
var dateField = new Ext.form.DateField({
name: fieldName,
format: 'd-M-Y',
disabledDays: [2,31],
disabledDaysText: 'Its a Weekend!!',
disabledDates:["01-Jan","25-Dec"],
disabledDatesText: 'Its a Holiday',
allowBlank:false
});
return dateField;
};


Can somebody help me in this,

Thanks in Advance,
Murali

denkoo
5 Mar 2008, 8:27 AM
look doc on Datefield

disabledDates : Array
An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular expression so they ...
An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular expression so they are very powerful. Some examples:

["03/08/2003", "09/16/2003"] would disable those exact dates
["03/08", "09/16"] would disable those days for every year
["^03/08"] would only match the beginning (useful if you are using short years)
["03/../2006"] would disable every day in March 2006
["^03"] would disable every day in every MarchIn order to support regular expressions, if you are using a date format that has "." in it, you will have to escape the dot when restricting dates. For example: ["03\\.08\\.03"].


for what you need :

maybe :

[".2/../....",".4/../....",".5/../....",".6/../....",".7/../....",".8/../....",".9/../....","1./../....","2./../....","3./../...."]


but about User, I prefer on this possibility, using combo with all date it's possible...12 by year, it's not long list !

ajax&me
5 Mar 2008, 9:13 AM
Thank u Very Much....Its working fine :):):):):)

ajax&me
8 Mar 2008, 11:21 AM
But If i want to disable all dates except last day of the month......

ajax&me
13 Mar 2008, 1:53 PM
Can somebody share thoughts on this....

dantheman
14 Mar 2008, 8:05 AM
But If i want to disable all dates except last day of the month......There are only 12 of those for a year, and they can be calculated easily.
A date picker is the wrong ui metaphor for that. You just need a month picker... :D

--dan

skippy
14 Aug 2008, 12:03 PM
I have a similar situation where I want the user to pick only the first day of the month. I agree that a combo box would be a better solution since there are only twelve choices, but the problem is I also need to allow the user to select the year and I don't want to use a separate combo box for that. What I really want is a month and year selector like you see in the standard date picker when changing the month and year (see attached image).

Any thoughts?

ktilt
14 Aug 2008, 12:34 PM
I have a similar situation where I want the user to pick only the first day of the month. I agree that a combo box would be a better solution since there are only twelve choices, but the problem is I also need to allow the user to select the year and I don't want to use a separate combo box for that. What I really want is a month and year selector like you see in the standard date picker when changing the month and year (see attached image).

Any thoughts?


try this one. ive been using it with no issues. http://extjs.com/forum/showthread.php?t=20181

skippy
15 Aug 2008, 6:31 AM
Dude, perfect! Thanks!