I have two fields: “show_name” and “episode_title.”
I’m using jQuery autocomplete, so that when a user enters the show name, such as “Frasier”, the autocomplete kicks in and searches mySQL. This is working.
Now, what I want to happen is that when the user starts typing the episode title in the “episode_title” field the search for titles is limited to the TV show in the “show_name” field, in this example: Frasier.
Is this possible?
<script type="text/javascript">
// jQuery AutoComplete for title text field
function selectItem(li) {
if(li.extra) {
alert("That's '" + li.extra[0] + "' you picked.")
}
}
function formatItem(row) {
return row[0] + "<br />";
}
$(document).ready(function() {
$("#title").autocomplete("search.php", { minChars:3, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem, formatItem:formatItem, selectOnly:1 });
});
</script>
<label for="title">Show Name*</label>
<div class="div_input">
<input type="text" name="show_name" id="show_name" />
</div>
<label for="title">Title*</label>
<div class="div_input">
<input type="text" name="title" id="title" />
</div>