Browser autocomplete selection fires validators script with false result. How to disable it?
I have:
<asp:TextBox ID="Profile_EMail" runat="server" CssClass="form" />
and
<asp:RegularExpressionValidator ID="Validator_Profile_EMail"
runat="server" ControlToValidate="Profile_EMail"
meta:resourcekey="Validator_Profile_EMa开发者_如何学编程il"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
on my ASP.NET form.
When user uses browser embedded autocomplete list and selects any element by pressing "Enter" button, validator fires. Always validation is not passed. Email pattern is proper. When user press "save" button, validation passes correctly.
How to fix this issue?
Nothing could be done, sad but true. When you press enter on autocomplete variant, it fires keypress event for input end validator gets not full string, but part you had inputted befor autocomplete was shown. Then as a variant could be disabled client validation.
精彩评论