Copy link to clipboard
Copied
I have Autosuggest or Autocomplete(are they the same thing?) working on one ColdFusion form where people register for an event by selecting their name from an input. In the past, I've used a CFSELECT which is dynamically populated from a CFQUERY array. Then, when the user clicks "Submit," the value that is passed is not the name, but the user ID, which is absolutely unique, in contrast to a name. So with a CFINPUT or INPUT field, what is passed is what the user entered, namely, the name selected. That isn't quite what I need. Is there a way to use Autosuggest so that a value from the database, other than the literal name that the user has selected in the form field, is what is passed to an action page, where I can do various queries based on a user ID? I haven't come across this in my Googling yet, and logically, it doesn't seem possible with a plain INPUT field. But is autosuggest a possibility with a CFSELECT field?
Copy link to clipboard
Copied
What you can probably do is populate a hidden form field at the same time you populate the text box.
However:
1. With autosuggest the user is free to reject all offerings and type whatever they want into the text box.
2. There is this little matter of duplicate names.
Copy link to clipboard
Copied
Dan,
Thank you for your perspective. That does it! I had the same misgiving about duplicate names and users entering anything in the box, although
I hadn't thought of the hidden form field. So I think the wise move here is to stick with CFSELECT, which is tried and true.
Feliz navidad y feliz ano nuevo!
Copy link to clipboard
Copied
Using a cfselect does not necessarily solve the duplicate names problem. How is the user supposed to know which one to pick? Also, if you start to get too many records, the select will take a long time to load.
Copy link to clipboard
Copied
What is the solution to duplicate names? With CFSELECT we query a database of all the names in a specific department with first name, middle initial, and last name.
I haven't heard from anyone that in the past duplicate names were a problem, but I'd be interested in pursuing your point and in considering options.