Burt Burt - 1 year ago 220
ASP.NET (C#) Question

ValidatorEnable is not defined

I am trying to enable and disable a required field validator using javascript but keep getting the error message ValidatorEnable is not defined. PLease find code below, any help would be great.


<asp:RequiredFieldValidator EnableClientScript="True" Display="None" ID="rfvMostRecentEmployer" ControlToValidate="txtMostRecentEmployer" runat="server" ErrorMessage="Most recent employer title is a required field"></asp:RequiredFieldValidator>


var validatorMostRecentEmployer = document.getElementById('<%= rfvMostRecentEmployer.ClientID %>');

ValidatorEnable(validatorMostRecentEmployer, !hasCv);

Code Behind

protected void Page_Load(object sender, EventArgs e)
rblCV.Attributes.Add("onClick", string.Format("ShowCvOptions();"));

Answer Source

Make sure that function ValidatorEnable is placed before calling from any other place.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download