ASP.Net 4.0 中是否仍支持 javascript ValidatorEnable?
我想通过特定条件禁用 RequireFieldValidator
控件。
我尝试过这段代码,
function doSomething()
{
var myVal = document.getElementById('RequiredFieldValidator1');
ValidatorEnable(myVal, false);
}
结果是,这个函数使验证消息消失,但当我们回发时验证仍然会触发。
I would like to disable a RequireFieldValidator
control by a certain condition.
I have tried this code
function doSomething()
{
var myVal = document.getElementById('RequiredFieldValidator1');
ValidatorEnable(myVal, false);
}
The result is, this function make the validation message disappear but the validation still fire when we post-back.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉打扰,我刚刚找到了自己问题的解决方案。这段代码确实禁用了客户端验证器,但我仍然需要通过以下代码在我自己的页面上设置禁用回发验证器。
Sorry for bothering, i have just found the solution to my own question. This code is truly disable the client-side validator but i still need to set the disable post-back validator on my own page by the following code.