1 Reply Latest reply on May 16, 2009 4:17 PM by Aquitaine

    Autosuggest - beyond the 1st word match

    Aquitaine Level 1

      I've searched for this and come to the conclusion that the answer is either so obvious that it's staring me right in the face, or else it's just something that the built-in autosuggest widget won't handle.

       

      I have a simple <cfinput> field that looks up a user account based on text input. The query it calls searches for a user's first name, last name, or email address based on the input. Using the AJAX debugging screen, I can see that the appropriate results are, in fact, being fetched by the query.

       

      The problem is, quoting from the livedocs for <cfinput>:

       

      "You do not have to limit the returned data to values that match the cfautosuggestvalue contents, because the client-side code displays only the values that match the user input. In fact, the called function or page does not even have to use the value of the cfautosuggestvalue

      parameter that you pass to it. You should, however, use the parameter if the returned data would otherwise be long."

       

      It's deciding that 'matching the user input' means 'matching the first word of the query results.' In other words, if I have two users, one named Joe Smith and one named Smith Joe, and I search for Smith, it will display Smith Joe but not Joe Smith, because it doesn't 'match.'

       

      Is there some way I can say that, if it matches ANY of the words in the query results, rather than just the first one, to include it in the list of autosuggestions?

       

      Thanks,

      Aq