<p>Song Name:<%= text_field :songlists, :song_name, :id => "songlists_" + section.id.to_s + "_song_name" %></p>
<%= auto_complete_field "songlists_" + section.id.to_s + "_song_name", :method => :get,
:with => "'search=' + element.value", :url => formatted_songlists_path(:js) %>
<p>Artist:<%= text_field :songlists, :artist, :id => "songlists_" + section.id.to_s + "_artist" %></p>
<%= observe_field ("songlists_" + section.id.to_s + "_song_name", :update => "songlists_" + section.id.to_s + "_artist", :with => "element.value" , :url => { :controller => :songlists, :action => "get_artist" }) %>
我有自動完成字段工作正常,並且觀察字段是根據螢火蟲觸發,但我不確定如何更新文本字段從觀察視野。Rails通過ID從auto_complete字段observe_field
我要麼需要獲得自動完成發現的ID,要麼輸入文本以便我可以將它傳遞到觀察字段的URL中。
任何想法?