I'm using a combobox to create a searchable list of employees from where the user needs to select one.
If there is a false name entered they should get a warning (which already works) and the first person in the list needs to be selected. I Was trying to do that like this:
And in javascript i'm doing this:
Could anyone help?
Thanks in advance
If there is a false name entered they should get a warning (which already works) and the first person in the list needs to be selected. I Was trying to do that like this:
<
div
class
=
"editor-field edit-project"
>
(Html.Kendo().ComboBox()
.Name("PersonId")
.HtmlAttributes(new { @class = "input-project" })
.DataTextField("Fullname").DataValueField("Id")
.DataSource(source => { source.Read(read => { read.Action("GetPeople", "Project"); }); })
.MinLength(3)
.Filter("contains")
.Events(ev => ev.Change("checkcombobox")))
</
div
>
function checkcombobox(e)
{
if (this.value() && this.selectedIndex == -1) {
alert('Gelieve een geldige persoon te selecteren');
var cbx = $("#PersonId").data("kendoComboBox").Selected(0);
}
}
Thanks in advance