# Hiding and expanding form fields?

**URL:** <https://www.ruby-forum.com/t/hiding-and-expanding-form-fields/76579>\
**Category:** Rails\
**Created:** [March 4, 2006, 8:16am UTC](https://www.ruby-forum.com/t/hiding-and-expanding-form-fields/76579 "2006-03-04T08:16:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [March 4, 2006, 8:16am UTC](https://www.ruby-forum.com/t/hiding-and-expanding-form-fields/76579/1 "2006-03-04T08:16:47Z")

</div>

Hi, I’m wanting to create a form where some of the for fields are  
hidden until the user clicks the advanced link. BTW, I’m looking for  
the functionality similar to the Rails Welcome page (i.e.  
[http://localhost:3000](http://localhost:3000)). The relevant link hear is as follows:

[http://localhost:3000/rails\_info/properties](http://localhost:3000/rails_info/properties)

In short, it seems to be a expand and collapse functionality using  
AJAX. However, I’ll be using form elements instead. For example,

Well, I must go and thanks in advance.

Peace,

-Conrad

---

<div class="post-metadata">

**Author:** ![conz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a5b964/32.png) [@conz](https://www.ruby-forum.com/u/conz)\
**Post date:** [March 4, 2006, 9:38am UTC](https://www.ruby-forum.com/t/hiding-and-expanding-form-fields/76579/2 "2006-03-04T09:38:11Z")

</div>

havent verified this but,

i think you can use link\_to\_function and have the function be something  
you  
define. I think you can define it right there using function() {  
Element.toggle(your\_input\_element); Element.toggle(some other element) }

Or you could just write a custom function and have it referenced in the  
link\_to\_function call.
