Forums
This topic is locked
Autocomplete Multiple Fields
Posted 25 Mar 2011 02:20:29
1
has voted
25 Mar 2011 02:20:29 Oliver Fleener posted:
Your Ajax Auto Complete obviously does not allow to fill in multiple fields with a selection or pass a unique ID to a hidden field. I see it has been requested multiple times... it is frustrating... With that said can you help me modify your code to do it? I have a feeling the following should be added after the initial field:
Original----
<input name="City" type="text" id="City" size="20">
<script type='text/javascript'>
jQuery(document).ready(
function() {
jQuery('#City').autocomplete('autocomplete-city.txt',
{
//// DMX design input here - taken out to shorten post
})});
</script>
On my city.txt file I have the state as the secondary data and a "state" text field after the city. I have a feeling something like the below needs to be added, and I have tried multiple ways to do so but to no avail.
jQuery("#City').result(function() {
if (data)
jQuery(this).parent().next().find('#state').val(data[1]);
});
Or is it....
select: function( event, ui ) {
jQuery('#State').val(ui.item.label);
}
Before the closing tags?
Can you coach along until you update the extension.