I am using a regular expression validator to validate several fields on an asp.net form. Here is an example:
<asp:RegularExpressionValidator runat="server"
ID=RegularExpressionValidatortxtEMAIL ControlToValidate="txtEmployerEmail"
ErrorMessage="EMail Address - must be valid"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic" ></asp:RegularExpressionValidator>
The problem is that after the user enter a invalid value and then corrects it with a valid valu开发者_高级运维e, the error message persists until a postback is generated.
Is there any fix for this?
There's nothing wrong with that validator tag - I've just used it in a page and it works fine. You understand that the validator only gets fired when the control loses focus... It could be something else in your page that's causing the problem, perhaps a JavaScript error?
精彩评论