CustomValidator client script not firing
I have a page where the user enters address data. They can select a country from a drop down list. Depending on what country is selected, the user enters their province/state by either a textbox or a drop down list.
If they select USA/Canada, a drop down list is populated with the states/provinces and made visible, while the state textbox is made invisible. If they select a country other than USA/Canada, the state drop down list is made invisible, and a state textbox is made visible. The first item in the drop down list is "select your state/province" with a value of "".
here is my validator:
here is my validation function:
<asp:CustomValidator ID="cvState" runat="server" ClientValidationFunction="validateStateSelection" ErrorMessage="* Required" ControlToValidate="ddlCountry" ValidateEmptyText="True"></asp:CustomValidator></td>
function validateStateSelection(source, arguments)
alert("client validation func called");
if(arguments.Value == null || arguments.Value == "")
arguments.IsValid = false;
arguments.IsValid = true;
you can have 2 different validation controls to validate the same control.
You can add a compare validator to the state control. Set your "select your state/province" with a zero or a high number you are sure the rest of the options don't have then set the value to compare to that number. Set the operator to NotEqual.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)