Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
WebMaskEditor and RegularExpressionValidator Problem
posted

Hello,

I have an issue with the WebMaskEditor control.  If I use this code on my ASPX page:

Zip:<ig:WebMaskEditor ID="mskZip" runat="server" CssClass="TextBox" InputMask="00000-0000" Width="90px" />
<asp:RegularExpressionValidator ID="zipValidator"  runat="server"                                  ErrorMessage="Invalid Zip Code"                                 ValidationExpression="(^(?!0{5})(\d{5})(-?)(?!0{4})((\d{4})||(_{4}))?$)"                                  ControlToValidate="mskZip">*</asp:RegularExpressionValidator>

I cannot get the validator and the WebMaskEditor to play well together. The issue that I am having is the validation control will mark the mskZip value as invalid when the value is "55555-".
The regular expression I am using should allow "5555-". As a matter of fact, it works great if I replace the WebMaskEditor with a regular ASP textbox. So I guess the issue I am really having
is that the RegularExpressionValidator doesn't work the same with the WebMaskEditor control as it does with an ASP textbox. I thought the issue might be that the validation control was seeing
the underscores in the WebMaskEditor control so I modified the regular expression to account for those. Testing it yielded the same results. Again, if I replace the WebMaskEditor with a
textbox it works as I would expect.

Here is what the code looks like whenever I replace the WebMaskEditor with a textbox:
Zip:<asp:TextBox ID="mskZip" runat="server" CssClass="TextBox" Width="90px" /> <asp:RegularExpressionValidator ID="zipValidator"                                  runat="server"                                  ErrorMessage="Invalid Zip Code"                                 ValidationExpression="(^(?!0{5})(\d{5})(-?)(?!0{4})((\d{4})||(_{4}))?$)"                                  ControlToValidate="mskZip">*</asp:RegularExpressionValidator>

Any idea how I can work around this issue?

 

Kevin

Parents
No Data
Reply
  • 13438
    posted

    Hello Kevin,

    Thank you for posting in our community. Can you please specify the exact version and build of NetAdvantage you are using. I will test the code and i will provide you with my findings. Also it would be nice if you specify the browsers you are using to test and your CLR.

Children