Forum: Ruby on Rails Initializing dynamically generated Multiple check boxes (AJA

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.
E3640176765dae2465d33ef6eb114691?d=identicon&s=25 (Guest)
on 2007-07-15 03:35
(Received via mailing list)
I am able to read the values of dynamically generated check boxes when
the user selects or deselects the checkbox. But it is not clear from
Rails documentation on how to populate the check boxes when it is
displayed for the first time.

I have the following in my index.rhtml

<% form_remote_tag :update => "feedback_message",
           :url => { :action => :update },
           :html => { :id => "my_dom_id"} do %>

<div id="my_form_check_boxes">
  <% form_ids = [] %>
  <%  @foo.each_with_index do |s, i| %>
    <div class="my_check_box" id="<%= s.dom_id %>">
      <%= check_box "#{s.dom_id}#{foo_ids[i]}", "my_attribute",
           :onclick => remote_function(:update => "feedback_message",
                          :url => { :action => "update", :id =>},
                        :complete => "'feedback_message')",
                          :submit => "my_dom_id" ) %>
        <label> <%= %> </label>
  <% end %>

This topic is locked and can not be replied to.