Fun with Javascript and Checkboxes or how to check all your boxes (Ruby on Rails)

Multiple selection areas (where you’re deleting a set of things, hiding them) a la checkbox can seem a little daunting, especially in Rails where everything isn’t done The Way You’re Used To Doing It. Without going too deep, there is a little bit to be said about making all those little Javascript checkboxes toggle on and off without inserting any foreign Javascript outside of the defaults (prototype library, etc) that Rails provides.

Following off of a post on railsforum.com, I started with that and made a toggle box that might have broken a few rules, but can be generally dropped into any Rails application for full toggle switching with one input box.

http://snippets.dzone.com/posts/show/3651 (open in new window)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: