views:

69

answers:

1

I'm using he following code the call a CFC which returns auto-suggest results through AJAX.

<cfinput type="text" class="titleSearchField" name="TitleName"
autosuggest="cfc:gz.cfcomp.search.AutoSuggestSearch({cfautosuggestvalue})">

What this does right now is only generate an Auto-suggest list. Clicking on one of the auto-generated results does nothing, but retain it in the input field. How do I make the search form visit a results page when clicked? Do I have to use the onClick attribute and pass the results for an additional query to full process the result?

At suggestion below I added the following:

action="search.cfm?GameID=#AutoSuggestSearch.GameID#"

But it's throwing an error that GameID is not defined in AutoSuggestSearch (although I am selecting it from in the CFC query).

+2  A: 

Did you try using onChange on the cfinput? That way when you select the value, you can fire off a form post (or another ajax request) to do a search.

CF Jedi Master
Wow, first of all I can't believe who just answered my question! That's awesome! I'm using Ben's book as we speak! As to your question, no, I have not. Does it have to be a JavaScript function that references an action form? What if JavaScript is disabled?
Mel
If JS is disabled, then you can only rely on the Submit button.
Henry
As Henry says, if JS is disabled, it must be a 'proper' real form submit.
CF Jedi Master