# Collapsible Fieldset

**URL:** <https://www.ruby-forum.com/t/collapsible-fieldset/160376>\
**Category:** Rails\
**Created:** [February 15, 2009, 3:27pm UTC](https://www.ruby-forum.com/t/collapsible-fieldset/160376 "2009-02-15T15:27:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@juli](https://www.ruby-forum.com/u/juli)\
**Post date:** [February 15, 2009, 3:27pm UTC](https://www.ruby-forum.com/t/collapsible-fieldset/160376/1 "2009-02-15T15:27:00Z")

</div>

Hey there,

(First steps in Ruby and Rails…)

I’m trying to make a fieldset collapsible, like they are, for example,  
on many Drupal pages.

What I’ve figuared out is the following:

 \<%= link\_to\_function("Show/Hide Addressdata") { |page| page[: addressdata].toggleClassName('collapsed') } %\> ... some forms etc. here ...

In CSS, I do a display:none for the class ‘.collapsed’, but  
display:block for ‘.collapsed legend’.

So this is working. But it doesn’t look very well. I’d like some  
eyecandy, like a fade-in/out or scroll-up/down and a nice arrow which  
indicates, that this is sth. collapsed or collapsible. Also, it would be  
nice to have the linktext “Show” if the fieldset is hidden and vice  
versa.

I surfed the web a lot and found out about [script.aculo.us](http://script.aculo.us) and  
prototype, but I just couldn’t bring it all together. Is there a simple  
tutorial or example for this? Or does anybody of you have a few lines of  
code as an example for me?

Thanks in advance,  
Julian

---

<div class="post-metadata">

**Author:** ![juli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@juli](https://www.ruby-forum.com/u/juli)\
**Post date:** [February 15, 2009, 4:10pm UTC](https://www.ruby-forum.com/t/collapsible-fieldset/160376/2 "2009-02-15T16:10:02Z")

</div>

Hey julian L. Nice name! I’m Julian L too!! 🙂 Hehe anyway check the  
demos on scriptsculous website itself. In particular slide and blind.  
They have rails helper versions, too.

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

On 16/02/2009, at 1:27 AM, “Julian L.” \<rails-mailing-list@andreas-

---

<div class="post-metadata">

**Author:** ![juli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dfb087/32.png) [@juli](https://www.ruby-forum.com/u/juli)\
**Post date:** [February 15, 2009, 4:13pm UTC](https://www.ruby-forum.com/t/collapsible-fieldset/160376/3 "2009-02-15T16:13:33Z")

</div>

maybe this link helps to understand prototype:  
[http://prototypejs.org/learn](http://prototypejs.org/learn)
