# Indexed Text Input -\> Ajax with Helpers

**URL:** <https://www.ruby-forum.com/t/indexed-text-input-ajax-with-helpers/53048>\
**Category:** Rails\
**Created:** [January 23, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/indexed-text-input-ajax-with-helpers/53048 "2006-01-23T23:04:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 23, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/indexed-text-input-ajax-with-helpers/53048/1 "2006-01-23T23:04:54Z")

</div>

Hello again.

I can get my input forms doing what I want using the ‘:index =\>  
object\_counter’ syntax which is very nice.

However, the Ajax text\_input\_with\_auto\_complete seem not to be able to  
account for the :index.

I can see in the source why this is the case. I have a workaround  
that is an ugly kludge. I am wondering if there is any less-ugly  
kludge that I can try.

Again, I would like to do

\<%= text\_input\_with\_auto\_complete :timecode, :timecodedesc, :index =\>  
timecode\_counter %\>

but instead have to do this mess

\<%= text\_field “timecode”, “timecodedesc”, :index =\> timedetail\_counter  
%\>

 \<%= auto\_complete\_field 'timecode\_' + timedetail\_counter.to\_s + '\_timecodedesc', :update =\> 'timecode\_' + timedetail\_counter.to\_s + '\_timecodedesc\_auto\_complete', :url =\> '/timecard/auto\_complete\_timecodedesc' %\>

where /timecard/auto\_complete\_timecodedesc is a simple lookup which  
ignores the index (since there is only one field being updated at a  
time) and returns the required unnumbered list.

If this is the “easiest” way to do this, could I not write my own  
“text\_input\_with\_auto\_complete” that accounts for indexes and put it  
in /vendor or something?

Thank you in advance…

- Ian
