Forum: Ruby on Rails Indexed Text Input -> Ajax with Helpers

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ian H. (Guest)
on 2006-01-24 00:04
(Received via mailing list)
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
  <div class="auto_complete" id="timecode_<%=
  <%= auto_complete_field 'timecode_' + timedetail_counter.to_s +
      :update => 'timecode_' + timedetail_counter.to_s +
      :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
This topic is locked and can not be replied to.