禁用验证 [英] Disabling validations

查看:57
本文介绍了禁用验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题的简要概述......我在页面中有某些文本框(例如,txtbox2),只有在填充了某些其他文本框(例如,txtbox1)时才需要填充。为此,我在asp.net代码中禁用了txtbox2的requiredfield验证器,然后编写了一个javascript,以便在所需条件下启用这些文本框。所有这一切都很好....


在我的提交按钮中我写了这个,

Brief overview of my problem......I have certain text boxes(say, txtbox2) in a page that have to be filled only if certain other text boxes(say, txtbox1) are filled. For this, I have disabled the requiredfield validators for txtbox2 in the asp.net code and then wrote a javascript to enable these text boxes on the required conditions. All this works well....

In my submit button I have written this,

展开 | 选择 | Wrap | 行号

推荐答案

嗯...请考虑以下事项:

Hmm...consider the following:

展开 | 选择 | Wrap | 行号


感谢您的回复,但对于延迟回复感到抱歉...

如果我实施您的案例,我仍然会遇到问题。问题是,如果填充了textbox1,我会提示用户输入textbox2。但是如果用户没有进入并尝试提交页面,它仍然会接受它,因为page.validate是真的。 javascript只是提醒用户,但没有强迫他进入。这就是我起诉必需的字段验证器以确保当用户没有输入文本时Page.validate为false的原因。


我很震惊。我试图修改我现有的JavaScript但无济于事。


感谢您的时间。
thank you for the reply but sorry for the delay in the response...
If I implement your case I would still have the problem. The thing is I would prompt the user to enter in textbox2 if textbox1 is filled. But if the user does not enter and try to submit the page it would still take it because the page.validate is ture. the javascript is just alerting the user but not forcing him to enter. That is the reason I am suing the required field validator to ensure the Page.validate is false when the user does not enter the text.

I am struck at this point. I am trying to modify my existing javascript but to no avail.

Thank you for your time.


我从未真正使用过ASP.NET中的验证器。

您是否尝试使用我在if / elseif / else块中列出的案例来启用/禁用验证器而不是显示警报?


-Frinny
I''ve never really played a lot with the validators in ASP.NET.
Have you tried using the cases that I outlined in the if/elseif/else block to enable/disable the validators instead of displaying alerts?

-Frinny


这篇关于禁用验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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