I'm using a RegularExpressionValidator in ASP.NET. I have these validators for my asp:Textbox control:
<asp:RangeValidator
ID="rvDate"
runat="server"
ControlToValidate="txtCrimeDate"
Type="Date"
ErrorMessage="Must be within latest three months"
Display="Dynamic"
OnInit="RangeValidator_Init">
</asp:RangeValidator>
<asp:RegularExpressionValidator
ID="revDate"
runat="server"
ControlToValidate="txtCrimeDate"
Display="Dynamic"
ErrorMessage="Must be in format YYYY-MM-DD"
ValidationExpression="[0-9]{4}-[0-9]{2}-[0-9]{2}">
</asp:RegularExpressionValidator>
I have set the min and max value of the RangeValidator in the code-behind and it works as intended. But! If I enter something with 2 numbers for the year, like 15-11-28 everything passes, even the other validators for the other controls. Any ideas?