我正在试图弄清楚如何检查combobox
的选定值是否不是“-1”。我使用的是customvalidator
和ClientValidationFunction
。
//A customvalidator clientValidationFunction checking if a combobox control has a valid (not -1) selectedvalue
function ValidateComboboxSelection(source, arguments) {
var comboBoxListItems = document.getElementById('ctl00_ContentPlaceHolder1_cbxCompany_OptionList').value;
if (null != comboBoxListItems) {
var iValue = new Number(combobox[combobox.selectedIndex].value);
arguments.IsValid = (iValue > -1);
}
else {
arguments.IsValid = false;
}
}