Jquery autocomplete not able to pass value to hidden field

mcstir

New Member
I have been trying to do auto complete using JQuery and JSP, but so far I couldn't get the value in hidden field successfully, I am able to get the department name though.Could someone point out what exactly is the problem?Code\[code\] <link rel="stylesheet" type="text/css" href="http://stackoverflow.com/questions/15676001/css/jquery.autocomplete.css" /> <script type="text/javascript" src="http://stackoverflow.com/questions/15676001/js/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="http://stackoverflow.com/questions/15676001/js/jquery.autocomplete.js"></script><script type="text/javascript"> $(document).ready(function() { $("#dept").autocomplete( "myData.jsp", { minChars:4, delay:30, autoFill:false, matchSubset:false, matchContains:1, selectOnly:1, select: function(event, ui) { $("#hid").val(result) } } ); }); \[/code\]and in myData.jsp I have // will move the code to Servlet\[code\]Department t = new Department (); String query = request.getParameter("q"); List<String> tenders = t.getDepartments(query); Iterator<String> iterator = tenders.iterator(); while(iterator.hasNext()) { String deptName= (String)iterator.next(); String depto = (String)iterator.next(); out.println(deptName); }\[/code\]
 
Back
Top