# How to get the current value of a select box?

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-current-value-of-a-select-box/92857>\
**Category:** Rails\
**Created:** [April 25, 2007, 4:45am UTC](https://www.ruby-forum.com/t/how-to-get-the-current-value-of-a-select-box/92857 "2007-04-25T04:45:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@Leo](https://www.ruby-forum.com/u/Leo)\
**Post date:** [April 25, 2007, 4:45am UTC](https://www.ruby-forum.com/t/how-to-get-the-current-value-of-a-select-box/92857/1 "2007-04-25T04:45:30Z")

</div>

Hey, guys

I want to get the value of select box when i call the action  
“get\_result”.  
Here is my code.

* * *
 \<%= observe\_field 'search\_form', :frequency =\> 0.5, :update =\> 'results', :url =\> { :controller =\> 'programs', :action=\> 'get\_results', :search\_type =\> 'select\_type' }, :with =\> "'search\_text=' + escape(value)"%\> \<%= select "select","type",{"BOY" =\> '1', "Girl" =\> '2'}%\> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* But i only get a string "select\_type" every time. Can you tell me how to deal with it? Thanks.

---

<div class="post-metadata">

**Author:** ![Leo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@Leo](https://www.ruby-forum.com/u/Leo)\
**Post date:** [April 25, 2007, 6:04am UTC](https://www.ruby-forum.com/t/how-to-get-the-current-value-of-a-select-box/92857/2 "2007-04-25T06:04:33Z")

</div>

BTW, if i replace “observe\_field” to “observe\_form”, a http post  
request will be sent every time when i refresh the page.
