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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8ed6d55dddf47e0974bac833f08e4390?d=identicon&s=25 Ian Harding (Guest)
on 2006-01-23 23: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_<%=
timedetail_counter.to_s%>_timecodedesc_auto_complete">
  </div>
  <%= 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
This topic is locked and can not be replied to.