'Validation for Kendo AutoComplete when user does not select the value

I want the validation for kendo AutoComplete when user does not select any value from AutoComplete Value that is populated.

For Little Bit background say I do have two controls one as Kendo AutoComplete and other is Input box if user types something in the AutoComplete the values is populated and he does not select any value and switch to next control it must give a validation message that please select the value from the AutoComplete.

and Also if the user type any string in the AutoComplete and Switch to next control it must also give the validation that "hey,this value is not in the AutoComplete" so that it must not save any other data other than AutoComplete datas that is being Populated. enter image description here



Solution 1:[1]

Heres how your auto complete is defined

 @(Html.Kendo().AutoComplete()
      .Name("countries")
      // etc.

On submit button click event

          <script>
             $("#btnSubmit").click(function(){

               var autoCompleteValue = $("#countries").val();

                   if (autoCompleteValue == "" || autoCompleteValue == null){
                            return false; //cancels submit action
                        }
                   // else let submit go through     
              });
           </script>

The null check is probably useless, cuz if it doesn't have a value it's usually equal to ""

Solution 2:[2]

The .val() solution did not work for me, because the .val() value of the control is still the text I entered (custom text, not any of the AutoComplete values), and that's wrong.

Solution is in preventing the custom input of Kendo AutoComplete. See this link: Kendo UI - Prevent Custom User Input in the AutoComplete

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CSharper
Solution 2 XzajoX