bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-15  01:34 UTC
Initializing dynamically generated Multiple check boxes (AJAX)
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 => s.id},
												:complete =>
"Element.show(''feedback_message'')",
										  		:submit => "my_dom_id" ) %>
	    	<label> <%= s.name %> </label>
		</div>
	<% end %>
</div>
TIA.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---