Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Custom validator for Ajax control Toolkit ComboBox

$
0
0

I am upgrading my project to Ajax Toolkit 7.1213.  I've used custom validators for all of my combo boxes and they don't work with the new version.  I'm sure it is a simple javascript tweak.  Can someone help me out?

<td class="fieldlabelsmall">Department:</td><td class="normal"><cc1:ComboBox ID="cboClientDepartment" runat="server" CssClass="windowsstyle"
    AutoCompleteMode="SuggestAppend" DropDownStyle="DropDown"  TabIndex="46"></cc1:ComboBox></td><td class="suffix"><asp:CustomValidator ID="cvClientDepartment" runat="server"
    ControlToValidate = "cboClientDepartment"
    CssClass = "textwarning"
    Display = "Dynamic"
    ClientValidationFunction = "cboClientDepartmentValid">Item not in List</asp:CustomValidator></td>


function cboClientDepartmentValid(sender, args) {
if (document.getElementById('ctl00_MainContentPlaceholder_cboClientDepartment_HiddenField').value >= 0) {
args.IsValid = true;
return;
}
else {
if (document.getElementById('ctl00_MainContentPlaceholder_cboClientDepartment_TextBox').value == "") {
args.IsValid = true;
return;
}
else
args.IsValid = false;
}
}

It is complaining about the .value, because it can't find the element.  I assume it means they've changed how they name their combobox components. But I'm not sure where to find the new names.

Ideally I would like to get away from having to write a javascript function for every combo box, so if someone could help me with a more generic one, I would appreciate it.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>