Why is this CustomValidator client function not firing?

Posted by xaisoft on Stack Overflow See other posts from Stack Overflow or by xaisoft
Published on 2014-06-10T21:12:52Z Indexed on 2014/06/10 21:24 UTC
Read the original article Hit count: 181

Filed under:
|

I have a dropdown with the Id of "BACKGROUND" and if nothing is selected or the value is other, it should fire my client side validation function, but it is not. Am I missing something?

I have the following client side function:

function cv26(oSrc, args) {//BACKGROUND,BG_OTHER 
            alert("cv26"); 
            var otherCtrl = document.getElementById("BG_OTHER"); 
            args.IsValid = (args.Value != " ") || (otherCtrl.value.length > 0); 
        }

My Custom validator looks like this:

<asp:CustomValidator ID="cv26" runat="server" ErrorMessage="26. Background is required." ControlToValidate="BACKGROUND"  ClientValidationFunction="cv26" Display="Dynamic" ValidateEmptyText="true">*</asp:CustomValidator>

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about customvalidator