Using text_field_with_auto_complete in partials?

Anyone know how to use text_field_with_auto_complete in place of
f.text_field in the partial?

Using Ryan Bates' example (http://railscasts.com/episodes/75):

<%= text_field_with_auto_complete :task_attributes, :name, :object =>
task %>

Here's my problem...

Because it's a partial, the id and name attributes are duplicated for
each partial instance, so the autocomplete only works on the first
instance of the partial, not to mention it's invalid XHTML to have dupe
id's.

Each partial duplicates this:

<li>
<label>task:</label>
<input id="task_attributes_name" name="task_attributes[name]" size="30"
type="text" value="Mow the lawn" />
<div class="auto_complete"
id="task_attributes_name_auto_complete"></div>
<script type="text/javascript">
//<![CDATA[
var task_attributes_name_auto_completer = new
Ajax.Autocompleter('task_attributes_name',
'task_attributes_name_auto_complete',
'/projects/auto_complete_for_task_attributes_name',
{parameters:'authenticity_token=' +
encodeURIComponent('71b4e415efa47b3d43ae291388ea74cf0330d548')})
//]]>
</script>

<a href="#" onclick="mark_for_destroy(this); return
false;">&nbsp;<b>remove</b></a>
<input id="project_task_attributes__id"
name="project[task_attributes][][id]" type="hidden" value="1" />
<input class="should_destroy"
id="project_task_attributes__should_destroy"
name="project[task_attributes][][should_destroy]" type="hidden" />
</li>

Thanks,
Mark