开发者

RegularExpressionValidation error message not clear after value is fixed

开发者 https://www.devze.com 2023-03-23 01:31 出处:网络
I am using a regular expression validator to validate several fields on an asp.net form. Here is an example:

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消