help fix autosuggest
Hello, am having trouble with an autocomplete code with jsp with jquery.
The code is doing great autosuggest, but I cant select a choice from the suggest list.
How do I select a choice into the textbox?
here is the code..
Hello,
I have a piece of jsp code for autocomplete with jsp.
the problem is that, while the autocomplete is working properly, I cant select a choice from the suggestions..Any help will be highly appreciated.
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.text.*"%>
<% response.setContentType("text/html");%>
<%
String stri=request.getParameter("queryString");
String SQLstr = "SELECT disease_name FROM hp_diseases WHERE disease_name ILIKE '"+stri+"%' LIMIT 10";
ResultSet wardsRs = sessionBean.getDataResultSet(SQLstr);
Boolean colorRow = false;
try{
while(wardsRs.next()){
out.println("
+wardsRs.getString("disease_name")+"");
}
}catch(NullPointerException sqle){
out.print(sqle.getMessage());
}catch(Exception sqle){
out.print(sqle.getMessage());
}
%>
jQuery Auto Complete
function lookup(inputString) {
if(inputString.length == 0) {
$('#suggestions').hide();
} else {
$.post("autoSuggestTextbox.jsp", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}
});
}
}
function fill(thisValue) {
$('#inputString').val(thisValue);
setTimeout("$('#suggestions').hide();", 200);
}
$('#inputString').select(function() {
alert('Handler for .select() called.');
});
body {
font-family: Helvetica;
font-size: 13px;
color: #000;
}
h3 {
margin: 0px;
padding: 0px;
}
.suggestionsBox {
position: relative;
left: 260px;
margin: 0px 0px 0px 0px;
width: 200px;
background-color: #7845DD;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border: 2px solid #000;
color: #fff;
}
.suggestionList {
margin: 0px;
padding: 0px;
}
.suggestionList li {
margin: 0px 0px 3px 0px;
padding: 3px;
cursor: pointer;
}
.suggestionList li:hover {
background-color: #DD45CD;
}
Disease Name
Enter Disease Name
thank y'all




