Ajaxing Checkboxes

Hi,

I’ve the following call to link_to_remote:

<% @calendars.each do |c| %>
<%= link_to_remote 'dont show '+c.name, :url => { :action =>
‘update_calendar’, :id => c.id } %>

It shows a list with calendars.

When the user presses on the link it hides that calendar (given the id).
Fine.

But now it would be nice to replace the link by a checkbox. And the
update_calendar method would read the params[:id] and the
params[:selected] in order to show or hide a given calendar.

The problem is, I don’t have a “check_box_to_remote” method.

Can you give me some ideas on this? Or it’s not possible?

Thanks

The problem is, I don’t have a “check_box_to_remote” method.

Can you give me some ideas on this? Or it’s not possible?

if it really just hides the calendar in html and doesn’t do any
database stuff serverside you can do it like:

# calendar stuff here

<%=f.check_box, :onclick => “$(‘calendar_#{calendar.id}’).toggle()” %>

as i mentioned, this only makes sense if you dont need any serverside
action here.

Pascal

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs