2017-02-25 7 views
0

jqueryオートコンプリートウィジェットを使用しています。ユーザが会社や他のデータに関連付けられた番号を入力し、そのデータが他のフィールドに入力されています。現在、ユーザーは番号を入力してから、他のフィールドのリストを選択して完了する必要があります。私の目標は、ユーザーがリストから番号を選択する必要がなくなり、代わりに番号を入力して検索ボタンを押すと、フィールドに値が入力されます。どうすればこれを達成できますか?ここでJquery Autocomplete - 入力時にオートコンプリート

は私のコードです:

$("#moveinbooth").autocomplete({ 
    source: "/sites/schedule.php", 
    change: function (event, ui) { 

     if (!ui.item) { 
      //http://api.jqueryui.com/autocomplete/#event-change - 
      // The item selected from the menu, if any. Otherwise the property is null 
      //so clear the item for force selection 
      $("#moveinbooth").val(""); 
     } 

    }, 
    minLength: 0, 
    position: { 
     my: "center bottom", 
     at: "center top", 
     collision: "flip" 
    }, 
    scroll: false, 
    select: function (event, ui) { 
     $(this).autocomplete('disable'); 
     $('#exhibitorname').val(ui.item.exhibitor); 
     $('#moveindate').val(ui.item.moveindate); 
     $('#moveintime').val(ui.item.moveintime); 
     $('#moveoutdate').val(ui.item.moveoutdate); 
     $('#moveouttime').val(ui.item.moveouttime); 
    } 

}) 

答えて

0

彼らはそれを選択し、それを入力し、しないようにしている場合、あなたはまだオートコンプリートが必要なのでしょうか?あなたがして、あなたの問題は、まだ番号が完全に入力されている場合でも、リスト内でそれを選択する必要があるということです、単に選択イベントまたはTabキーまたはEnterキーを聞く。

関連する問題