Hi, I''m developing a daily report module for a school work that utilizes complex forms, however I''ve run into some problems. On each rendered partial, I have two collection_select; the first (project) updates the contents of the second (task) depending on the selected project. I need a counter to connect to the task div id so that each project collection_select know which task collection_select to update. Here is a part of the code in the partial: _day_entry.html.haml: %td = day_entry_detail_form.collection_select(:project_id, @projects, :id, :proj_code_and_name, {:include_blank => "# {I18n.t :select_one}"}, :onChange => "showTaskSelection($(this), ''task_form_<counter_goes_here>''), ''1''") %th{:scope => "row", :class => "column1"} = I18n.t :task %span{:style => ''color:#FF0000''}* %td %div{:id => "task_form_<counter_goes_here>"} - for project in @projects %div{:id => "project_#{project.id}_task_", :style => "display:none"} = day_entry_detail_form.collection_select(:task_id, project.project_task, :id, :task_code_and_name, {:include_blank => "# {I18n.t :select_one}"}) and this code snippet renders the partial: new.html.haml: #day_entry_details = render :partial => ''day_entry_detail'', :collection => @day_entry.day_entry_details, :locals => {:from_collection => true} .form-btn = link_to_function "#{I18n.t :add_entry}" do |page| - page.insert_html :bottom, :day_entry_details, :partial => ''day_entry_detail'', :object => DayEntryDetail.new, :locals=> {:from_collection=>false} I need to have a counter that increments every time the link_to_function is used, and then use this counter as part of a div name. I tried using a hidden field and then just calls a javascipt function to increment it, but I don''t know how I''ll be able to access that for use with the div id...I''ve just started developing in rails and not yet familiar with everything. Any ideas or a push in the right direction would be a great help ^_^ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.