Click here to Skip to main content
15,922,145 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I want to Force user to select item from autocomplete list.I got the following code from a link.after implementing the below javascript functions the autocomplte list does not appear.If i remove calling the below javascipt functions,the autocomplte list appears.
XML
<script type="text/javascript" language="javascript">
       var isItemSelected = false;
       //Handler for AutoCompleter OnClientItemSelected event
       function onItemSelected() {
           isItemSelected = true;
       }
       //Handler for textbox blur event
       function checkItemSelected(txtPCodebox) {
           if (!isItemSelected) {
               alert("Please select item from the list only!");
               txtPCodebox.focus();
           }
           else {
               //reset isItemSelected
               isItemSelected = false;
           }
       }
   </script>

What is the problem i am not able to figure out.If there is any other method to to the same thing?Please help....
Posted

1 solution

That "forcing" would simply defeat the purpose of autocomplete. It means that you need to use a simple drop-down control to select one of the options, which you still can generate dynamically.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900