# Select onchange question

**URL:** <https://www.ruby-forum.com/t/select-onchange-question/161165>\
**Category:** Rails\
**Created:** [February 24, 2009, 2:24am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165 "2009-02-24T02:24:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 2:24am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/1 "2009-02-24T02:24:57Z")

</div>

I have this select statement, trying to change to a page that is the  
value of the select:

\<%= select(:node, :id, $shelves,{:prompt =\>‘Select Equipment’},  
{ :onchange =\> "document.location.href = ‘/buildshelf/’ + $F('node\_id  
').value + ’ "} ) %\>

How do I make this happen?

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 2:44am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/2 "2009-02-24T02:44:16Z")

</div>

What is the HTML that is rendered from that?

Groove

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 2:48am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/3 "2009-02-24T02:48:57Z")

</div>



---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 3:32am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/4 "2009-02-24T03:32:50Z")

</div>

Can you see the problem there in the rendered HTML?

Groove

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 3:36am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/5 "2009-02-24T03:36:58Z")

</div>

Well I did this:  
:onchange =\> "document.location.href = ‘/buildshelf/’ + $F  
(‘node\_id’).value + "

for the onchange part and I get this for html, still puzzled:

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 4:27am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/6 "2009-02-24T04:27:19Z")

</div>

couldn’t you just do something like:

onchange=“document.location.href = ‘/buildshelf/’ + this.value”

Groove

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [February 24, 2009, 4:33am UTC](https://www.ruby-forum.com/t/select-onchange-question/161165/7 "2009-02-24T04:33:47Z")

</div>

Of course, but I would have to pull my head out of my butt first. DOH!
