views:

328

answers:

2

I used a simple CFInput autosuggest code (copied from Ben Forta's blog http://bit.ly/5fFspb). It works ok but I need one additional feature:

After a user has used the autosuggest field to choose something, I would like to populate a second form field with the result ... but it doesn't work like in Javascript (using onChange and the value property of the field) - it seems that the "value" property contains the original user input, not what he chooses from the autosuggest list. For the life of it I can't find out how to copy the chosen autosuggest value to another field using Javascript. Anyone?

A: 

Can you post your code? My guess is you want the second cfinput to be similar to line with *'s:

<cfform>
Art:
<cfinput type="text"
        name="artname"
        autosuggest="cfc:art.lookupArt({cfautosuggestvalue})">
**<cfinput type="text" name="second" bind="{artname}"/>**
</cfform>
Sam Farmer
A: 

Can you post your code?

I really don't have any working code except the Ben Forta code, only that I have two autosuggest fields instead of one.

Both fields should work as autosuggest fields - one refers to the numeric keys, one to the corresponding text values, but both read from the same table. After choosing something from one of them, the result should be copied to the other field. If the user chooses a numeric key (which should display the corresponding text values as well), the corresponding text should be filled into the second field, and vice versa.

Also, to make things even more complex, there are two more rows in the table that should also be posted to other (static) form fields once the user has decided for an entry in the table.

veloopity