PDA

View Full Version : ExtJS Date Picker disable Dates after a Particular Date



ajeeshkumar
25 May 2012, 10:37 PM
Hi..
I want to enable only a range of values before a particular date. I am doing a birthday datepicker. The one with more than 18 years of old should be able to register. So I have to disable all the dates which does not satisfy this condition. Could you please help me!

Thanks!!

chramer
26 May 2012, 6:09 AM
Yep..
Use maxDate (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.picker.Date-cfg-maxDate) property of the datepicker..
Set the value to


value = new Date();
value.setYear(value.getYear()-18);

talha06
26 May 2012, 2:14 PM
You can add a listener before each page load then use setMaxValue (http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Date-method-setMaxValue) method of date field with a function that calculates the right max. date value.