自定义验证器不起作用

时间:2014-02-06 23:54:31

标签: javascript asp.net validation

我有自定义验证器来检查两个单选按钮,在asp.net中它们看起来像这样:

<asp:CustomValidator id="learningDisVal" runat="server" Display="Dynamic" ErrorMessage="Learning Disability is Required" Enabled="true" ClientValidationFunction="learningDisValidator"/>

并在脚本中:

<script type="text/javascript">
    function learningDisValidator(source, args) {
        if (document.getElementById("<%= persLearningDisabilityYes.ClientID %>").checked || document.getElementById("<%= persLearningDisabilityNo.ClientID %>").checked) {
            args.IsValid = true;
        }
        else {
            args.IsValid = false;
        }

    }
</script>

现在我将它们移动到脚本中,因为它们目前位于.aspx页面中,但它们不起作用。我把他们搬回原来的地方,但他们仍然没有工作。我一直试图找出问题已经有一段时间了,我似乎无法找到问题,有人能指出我正确的方向吗?

0 个答案:

没有答案