c# - ASP.NET Regex Date Validation rejecting specific dates -
this strange one, i'm working site involves bunch of input (as many do), have problem regularexpressionvalidator flagging valid dates incorrect, following ones:
- 10th - 29th june
- all of february
everything else works fine, , postback never sent server validation code-behind can't blame. references in code validation follows:
<asp:textbox id="txtvalidfrom" runat="server" placeholder="dd/mm/yyyy" > </asp:textbox> <asp:requiredfieldvalidator id="reqvalidfrom" runat="server" errormessage="required" cssclass="errormessage" controltovalidate="txtvalidfrom"> </asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="regexvalidfrom" runat="server" controltovalidate="txtvalidfrom" display="dynamic" errormessage="date not in correct format" text="wrong format!" cssclass="errormessage" validationexpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$"> </asp:regularexpressionvalidator>
the regex string works dates after 1900. strange thing it's project that's having issue, i've tested above code on fresh asp.net 2, 3 , 4 project, , works fine, validates above dates correct no errors.
i can imagine it's either wrong deployment, or there's conflict between javascript asp generates , in project (like jquery); i'd expect if case, wouldn't work @ - not exclude pretty specific dates, , there's no js errors being thrown @ time in browser console.
has had experiences kind of thing? seems me pretty strange problem due specific dates issue.
thanks!
Comments
Post a Comment