隐藏选项卡或lostfocus上的validationsummary消息 [英] Hide validationsummary messages on tab or lostfocus

查看:92
本文介绍了隐藏选项卡或lostfocus上的validationsummary消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在我的页面上添加了必需的字段验证器,并在ValidationSummary中显示了消息。当我提交页面时,它会在摘要和控件旁边的文本中显示所有验证消息。现在,当我在文本框中输入一些文本并按Tab键时,除了控件之外的文本消失了,但ValidationSummary中的消息仍然存在。



有没有办法在文本框中输入文本时,也可以在标签上删除消息吗?



我尝试过:



尝试显示动态,静态,无。

解决方案

没有内置选项可以做到这一点,并有充分的理由。



首先,页面会随着用户输入而跳转。这将导致可访问性问题并使用户烦恼。



其次,在用户提交表单之前,无法知道哪个验证组需要验证。



如果你想实现这个,你需要编写自己的Javascript,以便在相关时调用 Page_ClientValidate 更改 / 点击 / 模糊事件触发。

Hi,

I have added required field validators on my page and ValidationSummary to show the messages. When I submit the page, it shows all the validation messages in the summary and text adjacent to control. Now, when I enter some text in the textbox and press tab, the text besides the control goes away but message in the ValidationSummary stays there.

Is there a way to get rid of the message as well on tab when text is entered in a textbox?

What I have tried:

Tried Display Dynamic, Static, None.

解决方案

There's no built-in option to do that, and with good reason.

Firstly, the page will be jumping around as the user types. This will cause accessibility problems and annoy your users.

Secondly, until the user submits the form, there is no way to know which validation group needs to be validated.

If you want to implement this, you'll need to write your own Javascript to call Page_ClientValidate when the relevant change / click / blur events fire.


这篇关于隐藏选项卡或lostfocus上的validationsummary消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆