<p>Simple question really - how do I use <code>text_field_with_auto_complete</code> inside a <code>form_for</code> block?</p>

<p>I've tried doing <code>f.text_field_with_auto_complete</code> but that gives an error, and just using <code>text_field_with_auto_complete</code> by itself doesn't seem to do anything.</p>

<p>Am I missing something here?</p>

If your intent is to set a id field, you must:
render the results in LI items, each li having it DOM id set up to the id of the returned record, like this:
```
```
<UL>
       <LI ID="1">Item 1</LI>
       < LI ID="2">Item 2< /LI>
</UL>
```
```
Your text field would be something like:
```
```
<%= text_field_with_auto_complete :model, :method, {}, :after_update_element => ‘getSelectionId’ % >
```
```
and a javascript method called getSelectionId like this
```
```
function getSelectionId(text, li) {

alert (li.id);

}
```
```
note that you can do anything via javascript since you have the text and the li element available.
Another option is
this plugin