How can I validate whether input has been entered in an AutoComplete or a selection has been made in a DropDownList. If neither is true then it should fail validation. I'm just figuring out the Kendo Validation and if there was a length requirement maybe I'd be on the right track. Can someone suggest a successful way to validate this scenario?
Here's where I started:
I think this needs to be in here somewhere, but not sure if I have the whole thing put together properly.
Thanks in advance for enlightening me ;)
Here's where I started:
<
div
id
=
"cboSearchStringValidate1"
>
<
input
type
=
"search"
id
=
"cboSearchString1AC"
/>
<
input
id
=
"cboSearchString1DDL"
/>
</
div
>
$(
"#btnSearch"
).click(
function
() {
alert(
'start to validate'
);
$(
"#cboSearchStringValidate1"
).kendoValidator({
rules: {
customruleSearchStrings1:
function
(input) {
if
(cboSearchString1AC.length == 0 && $(cboSearchString1DDL).val ==
""
){
return
input.val() === "true"
;
}
return
true
;
}
},
messages: {
customruleSearchStrings1:
"Search must not be empty"
}
});
alert(
'validate checked'
);
}
);
var validator1 = $("#cboSearchStringValidate1").kendoValidator().data("kendoValidator");
if (!validator1.validate()) {
alert("validated search strings 1");
alert('yes, we are valid');
}
else {
alert("no such luck");
}