#autocomplete_path value?
Hi,
I have a FORMS API field that is acting like a CCK nodereference field like so:
$form['place_nid'] = array(
'#type' => 'textfield',
'#title' => t('Place'),
'#autocomplete_path' => 'admin/place_autocomplete',
);The problem is that when I accept an autocompleted value, it doesn't seem to actually update the value of the form... I mean I see the text in the form field, but when I try to get the value of the field with javascript I only get the text that I actually typed, not what was autocompleted.
For instance i start typing:
'de'
and it brings up an autocomplete dropdown list from which I select
'detroit [nid:22424]'
Now I run some javascript/jQuery:
$("input#edit-place-nid").val()But this only retrieves 'de', not 'detroit [nid:22424]' which is what I want.
Any help? Thanks.

bad subject
I probably should have titled this topic better... but too late now apparently.
Try to make a little delay
Try to make a little delay on it like:
setTimeout(function() {
$("input#edit-place-nid").val();
}, 100);
that worked, but another problem
Awesome! I hadn't thought of that (obviously) and it worked. I guess I was reading the value before it had a chance to actually be updated. Makes sense.
I have added a bit of code to the form element so an onChange should be fired when the value is changed:
'#attributes' => array('onChange' => "javascript:setTimeout('updateBookNid()','100');"),Now there is one more problem still happening... when I type some text and the autocomplete shows a dropdown of choices, if i arrow down and [enter] to select an option, the onChange event is fired. However, if I click one of the options the onChange event is not fired. Any idea why THAT would be happening?