LyndonOHRC
Programmer
I'm modifying a tutorial so I can learn to use auto suggest, can't seem to get it to work.
The persons name is not displaying in the select, it is displaying an empty list with the correct row count??? Also, when a row is selected in this empty list the "Search" input tag is not being populated but the "RecNum" input is.
Probably a simple problem but I seem can't spot it. Any help appreciated.
My source data seems to be returning in the proper format.
Source:
Lyndon
The persons name is not displaying in the select, it is displaying an empty list with the correct row count??? Also, when a row is selected in this empty list the "Search" input tag is not being populated but the "RecNum" input is.
Probably a simple problem but I seem can't spot it. Any help appreciated.
My source data seems to be returning in the proper format.
Code:
[
{"LicenseeName":"ANDREWS, TONI SMITH","RecNum":"41787"},
{"LicenseeName":"COLE, SMITH","RecNum":"56469"},
{"LicenseeName":"FOTOU, MARK SMITH","RecNum":"84872"},
{"LicenseeName":"GOLDSMITH, COTHEIA LASHAUN","RecNum":"89302"}
]
Source:
Code:
<!DOCTYPE HTML>
<html>
<head>
<title>
Name Search
</title>
<link rel="stylesheet" type="text/css" href="[URL unfurl="true"]http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/redmond/jquery-ui.css">[/URL]
<script src="[URL unfurl="true"]http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>[/URL]
<script src="[URL unfurl="true"]http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>[/URL]
</head>
<body>
<form action="index.cfm" method="post">
<fieldset>
<legend>
jQuery Autocomplete Name Search
</legend>
<label for="Licensee">
Licensee:
</label>
<input type="text" id="Search" name="Licensee" size="45" autocomplete="off" />
<label for="RecNum">
Record Number:
</label>
<input type="text" id="RecNum" name="RecNum" size="6" autocomplete="off" />
</fieldset>
<input name="Submit" type="submit" value="Submit">
</form>
<script type="text/javascript">
$('#Search').val(');
$('#RecNum').val(');
$(function() {
$("#Search").autocomplete({
source: "suggestListData.cfm",
minLength: 2,
select: function(event, ui) {
$('#Search').val(ui.item.LicenseeName);
$('#RecNum').val(ui.item.RecNum);
}
});
});
</script>
</body>
</html>
Lyndon