# Initializing dynamically generated Multiple check boxes (AJA

**URL:** <https://www.ruby-forum.com/t/initializing-dynamically-generated-multiple-check-boxes-aja/109454>\
**Category:** Rails\
**Created:** [July 15, 2007, 3:35am UTC](https://www.ruby-forum.com/t/initializing-dynamically-generated-multiple-check-boxes-aja/109454 "2007-07-15T03:35:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 15, 2007, 3:35am UTC](https://www.ruby-forum.com/t/initializing-dynamically-generated-multiple-check-boxes-aja/109454/1 "2007-07-15T03:35:48Z")

</div>

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 %\>

 \<% form\_ids = [] %\> \<% @foo.each\_with\_index do |s, i| %\> 
 \<%= check\_box "#{s.dom\_id}#{foo\_ids[i]}", "my\_attribute", :onclick =\> remote\_function(:update =\> "feedback\_message", :url =\> { :action =\> "update", :id =\> s.id}, :complete =\> "Element.show('feedback\_message')", :submit =\> "my\_dom\_id" ) %\> \<%= s.name %\> 
 \<% end %\>

TIA.
