devisubramani
April 2nd, 2008, 02:44 AM
from the calendar selected value is passed to the text box.
for instance if the text box value should be a valid date of birth.that is it shoyld not exit current date.
this validation should be done using javascript.
plzz help.its urgent.
tahnks in advance
nelo
April 2nd, 2008, 11:30 AM
What do you mean by a valid data of birth? the calendar control will not allow you to select an invalid date.
PeejAvery
April 2nd, 2008, 12:32 PM
[ moved ]
PeejAvery
April 2nd, 2008, 12:44 PM
Next time, try searching Google before posting. It will return thousands of results for javascript date validation.
The following allows for a period, slash, or hyphen as a separator.
function isValidDate(str) {
var datePattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
return (str != '' && str.match(datePattern)) ? true : false;
}