jquery-ui-autocomplete

jQuery UI autocomplete shows value instead of label in the input field

倾然丶 夕夏残阳落幕 提交于 2019-12-09 05:13:46
问题 A potentially simple issue with jQuery UI autocomplete is stumping me. My source is var ac = [ { label: "One Thing", value: "One-Thing" }, { label: "Two Thing", value: "Two-Thing" }, ] I am invoking the widget with $(function() { $( "#search" ).autocomplete({ source: PK.getAutocompleteSource(), focus: function( event, ui ) { $("#search").val(ui.item.label); return false; }, select: function( event, ui ) { $("#search").val(ui.item.label); PK.render(ui.item.value); } }); }); All works fine.

jQuery UI Autocomplete Not Filtering Data

三世轮回 提交于 2019-12-08 21:59:35
问题 So I searched but could not find the answer. This could be something trivial however I just can't see what is causing this. I'm using the jQuery UI Autocomplete, it's displaying the json results. So I know my JSON is valid. However, it's not filtering anything. So I can enter a number and it just show's all of the data. Any tips would be very much appreciated! I appreciate your time!! Here is my autocomplete code. $.widget('custom.catcomplete', $.ui.autocomplete, { _renderMenu: function(ul,

How to find out the category of selected element in AutoComplete?

不羁的心 提交于 2019-12-08 17:06:08
问题 I need to group AutoComplete results and I've found following solution. How can I figure out the category of selected suggestion? For example, lets say there are City and Country categories and user selects one of the cities. How am I supposed to know the selected item is part of city and not country category (When the form gets submitted)? I also do not want the category names be visible to users. What I have found so far $.widget( "custom.catcomplete", $.ui.autocomplete, { _renderMenu:

jQuery UI autocomplete combobox - prevent form submit

匆匆过客 提交于 2019-12-08 12:24:57
问题 I'm using the nifty 'combobox' variant of jQuery UI Autocomplete - see here: http://jqueryui.com/demos/autocomplete/#combobox I have it within a Form element because its part of a form. The Autocomplete Combobox has a <button> that is used to show the whole drop down list. However when the user presses it, the form submits. This appears to be because the <button> has a type="submit" attribute. The whole element is created by the button() call within the .combobox fn, see source code. How do I

jQuery UI Autocomplete on keyup?

好久不见. 提交于 2019-12-08 12:18:05
问题 I'm working with the jQuery UI library's autocomplete functionality. I have two form fields on a webpage - one is internal search, and one searches content my company manages on a third party site via a REST API. This works as it should - if I have the two form fields sitting next to each other, I can type into either and get the autocomplete results for that datasource below. What I've been asked to do, though, is combine the two fields into one "master" search field and hide the two

jQuery autocomplete is showing empty results

Deadly 提交于 2019-12-08 11:14:43
问题 I have this PHP script to get all patient name from my database: <?php error_reporting(E_ALL); ini_set("display_errors", 1); require_once('connection.php'); header("Content-type:application/json"); $cid = $_SESSION['clinic_id']; $res = array(); $getPatients = "SELECT * FROM patient WHERE clinic_id = :cid ORDER BY patient_id DESC"; $execGetPatients = $conn->prepare($getPatients); $execGetPatients->bindValue(':cid', $cid); $execGetPatients->execute(); $getPatientsResult = $execGetPatients-

jquery autocomplete search by lowercase

≡放荡痞女 提交于 2019-12-08 09:38:48
问题 I wanna work jquery autocomplete plugin with lowercase. The array includes uppercase, lowercase words. Bu when I write text in textbox, the jquery should convert to lowercase that text and convert the array words to lowercase then match words. var names = [{ value: "1", label: "Jon Kerer"}, { value: "2", label: "Scott MART"}, { value: "3", label: "Sel HURGE"} ];​ $("#myInput").autocomplete({ focus: ..... ? select : .... ? source : ... ? });​ 回答1: You will need to create a character map and do

jQuery autocomplete gives TypeError: this._renderItem(…) is undefined

孤者浪人 提交于 2019-12-08 07:30:56
问题 I'm currently using .data( "ui-autocomplete" )._renderItem = function( ul, item ) in three places in my page. Now I need to add one more and I'm done. But this time I get the error message TypeError: this._renderItem(...) is undefined The strange thing is that I only get this if my IF test is false. .data( "ui-autocomplete" )._renderItem = function( ul, item ) { // If only one row is returned and ID = 0, then return 'no result' message if(item.id == '0') { return jQuery( "<li></li>" ) .data(

Show Jquery UI Autocomplete only when a special key is pressed

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:53:11
问题 I have a textbox with autocomplete and I want to show the results only when the dot key . is pressed. I tried: $("#tags").on("keypress", function () { var keys = []; keys.unshift(e.which); if (String.fromCharCode(keys[0]) == ".") { } else { $("#tags").unbind(); } }); However, $("#tags").unbind(); removes all the events from the textbox, and if I press the dot key again, the results won't show up. How can I fix this? Live jsfiddle 回答1: Here is a solution that emulates what visual studio does:

jQuery autocomplete continuation instead of replace

回眸只為那壹抹淺笑 提交于 2019-12-08 04:48:07
问题 I am wondering how to make jquery append autocomplete choice to textbox when moving with arrows or pressing enter on choie instead of replacing the whole text in the text box? Here is my code so far: Server Side: public ActionResult Autocomplete(string lang, string query) { try { var term = query.IndexOf(',') > 0 ? query.Substring(query.LastIndexOf(',') + 1).ToLower() : query.ToLower(); if (!String.IsNullOrWhiteSpace(term)) { var data = context.Tags.Where(s => s.Name.StartsWith(term)).Select