# Help with link\_to\_function and creating pull down menu

**URL:** <https://www.ruby-forum.com/t/help-with-link-to-function-and-creating-pull-down-menu/87812>\
**Category:** Rails\
**Created:** [March 6, 2007, 5:17am UTC](https://www.ruby-forum.com/t/help-with-link-to-function-and-creating-pull-down-menu/87812 "2007-03-06T05:17:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 6, 2007, 5:17am UTC](https://www.ruby-forum.com/t/help-with-link-to-function-and-creating-pull-down-menu/87812/1 "2007-03-06T05:17:39Z")

</div>

Hi. I’m trying to create a pull down menu, but I’m not sure how to do  
it using the link\_to\_function in my view. When the user clicks on the  
select01.gif, the submenu on the side should display, else if should  
be hidden. Any help please. Thank you.

\<%= link\_to\_function( image\_tag(“graphics/  
select01.gif”, :alt=\>‘Programming’, :size=\>‘100x20’, :border=\>0),  
:update =\> “select01\_div”,  
:url =\>{ :action =\> :select01\_action }) %\>

 \<%= image\_tag 'graphics/ select01.gif', :alt=\>'Programming', :size=\>'100x20' %\>

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 6, 2007, 6:53am UTC](https://www.ruby-forum.com/t/help-with-link-to-function-and-creating-pull-down-menu/87812/2 "2007-03-06T06:53:46Z")

</div>

hi there  
you could use link\_to\_remote(link\_to) and there :onclick =\>  
remote\_funcion()  
to change the div you want  
I hope it helps

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 6, 2007, 7:07am UTC](https://www.ruby-forum.com/t/help-with-link-to-function-and-creating-pull-down-menu/87812/3 "2007-03-06T07:07:47Z")

</div>

Thanks. I also got this from the Internet, but I wonder if you or  
anybody knows how I can get the value of an element after setting it.  
The following will close a divider, but I want it to toggle so that if  
the user clicks on the “Close” again, the menu will reappear. To do  
that, I need to get the page[div].??? state of the divider somehow.

In the helper, I have  
module VideosHelper  
def hide\_and\_reset(div)  
update\_page do |page|  
page[div].hide  
end  
end  
end

Then in the view, I have

\<%= link\_to\_function "Close", hide\_and\_reset(:select02\_div) %\>

#### test
