I have a textbox which requires to fill out date in the format mm/dd/yyyy
I want to know how i custom my validiator to check if input is in right
format
Thanks
Printable View
I have a textbox which requires to fill out date in the format mm/dd/yyyy
I want to know how i custom my validiator to check if input is in right
format
Thanks
Use a regular expression validator.
Put this expression in the validation expression property:
That might not be exactly what you need, but it will get you started. In case you were wondering, it uses regular expression to match up the value entered to verify it is a correct date.Code:([1-9]|(0[1-9])|(1[0-2]))\/([1-9]|(0[1-9])|([1-2][0-9])|3[0-1])\/[0-9]{4}
I would still do a check on the server by trying to parse the text into a date object, and if it throws an exception, then kick that back to the user to reenter.