2017-02-25 1 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 키 누르기 만 듣기 만하면됩니다.