隐藏选项卡或lostfocus上的validationsummary消息 [英] Hide validationsummary messages on tab or lostfocus
问题描述
我在我的页面上添加了必需的字段验证器,并在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 callPage_ClientValidate
when the relevantchange
/click
/blur
events fire.
这篇关于隐藏选项卡或lostfocus上的validationsummary消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!