# Update href, on drop down menu selection change

**URL:** <https://www.ruby-forum.com/t/update-href-on-drop-down-menu-selection-change/109817>\
**Category:** Rails\
**Created:** [July 19, 2007, 10:25am UTC](https://www.ruby-forum.com/t/update-href-on-drop-down-menu-selection-change/109817 "2007-07-19T10:25:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimzava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ebca7d/32.png) [@dimzava](https://www.ruby-forum.com/u/dimzava)\
**Post date:** [July 19, 2007, 10:25am UTC](https://www.ruby-forum.com/t/update-href-on-drop-down-menu-selection-change/109817/1 "2007-07-19T10:25:25Z")

</div>

Hi there,

I have a drop down menu that looks like this:

 10 15 20 25 30

I also have some links that need to take dynamically the value of the  
option selected in the above drop down menu, so that this value can be  
passed as a parameter to my rails application, when the user clicks a  
link. For example, my links look like these:

[Foo  
Country](https://www.ruby-forum.com/person/list/?country=foo&results_per_page=[variable%20that%0Ashould%20change%20whenever%20a%20different%20option%20is%20selected]#results)

[Bar Area](https://www.ruby-forum.com/person/list/?area=bar&results_per_page=[variable%20that%20should%0Achange%20whenever%20a%20different%20option%20is%20selected]#results)

[English](https://www.ruby-forum.com/person/list/?language=en&results_per_page=[variable%20that%0Ashould%20change%20whenever%20a%20different%20option%20is%0Aselected]#results)

What I would like to achieve, is dynamically updating the value of the  
“results\_per\_page” parameter in those links, whenever the user selects a  
different option from the drop down menu. So, for example, when the page  
is first loaded, the value of the variable will be ‘10’ and then when  
the user selects, say, option ‘20’, this variable will be updated  
dynamically to ‘20’.  
This way, when one of the above links will be clicked, the right  
parameter value will be passed to my rails app.

I’ve tried using plain old JavaScript with ‘onchange’ as well as Ajax  
with an rjs template, to no avail. Any ideas??

Many thanks in advance,  
dimitris
