<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中。
任何想法?