Indexed Text Input -> Ajax with Helpers


#1

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