I'm trying the following code to execute a search and it's not working. On the search.cfm page, the only value coming back is the value I input into the search field (even if I click an autosuggest value, it's not coming back; only the letters I actually type myself come back).
<cfform class="titleSearchForm" id="searchForm" action="search.cfm?GameID=#cfautosuggestvalue.GameID#" method="post">
<fieldset>
<cfinput type="text" class="titleSearchField" name="TitleName" onChange="form.submit()" autosuggest="cfc:gz.cfcomp.search.AutoSuggestSearch({cfautosuggestvalue})">
<input type="button" class="titleSearchButton" value=" " />
</fieldset>
</cfform>
Query in CFC:
<cfquery name="SearchResult" datasource="myDSN">
SELECT CONCAT(titles.TitleName, ' on ', platforms.PlatformAbbreviation) AS sResult, games.GameID
FROM
games
Inner Join platforms ON games.PlatformID = platforms.PlatformID
Inner Join titles ON titles.TitleID = games.TitleID
WHERE
UCase(titleName) LIKE Ucase('#ARGUMENTS.SearchString#%')
ORDER BY
titleName ASC;
</cfquery>
Two things: First of all, I would like to get the GameID back to the page making the AJAX request; I know why it is not coming back: Because I'm only returning sResult var, which does not include the GameID. Is there a way to return the GameID value without displaying it?
The second thing: How to I grab a value from the auto-suggest once it is returned? Say I want to grab the GameID, or if I can't do that, the "TitleName" to use that in my query?
I tried passing it to the form this way: action="search.cfm?GameID=#cfautosuggestvalue.GameID#" - but that does not work. How do I reference the autosuggestionvalue varaibles for use?
Thanks