Forum: Ruby on Rails select onchange question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris H. (Guest)
on 2009-02-24 03:24
(Received via mailing list)
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?
groovetrain (Guest)
on 2009-02-24 03:44
(Received via mailing list)
What is the HTML that is rendered from that?

Groove
Chris H. (Guest)
on 2009-02-24 03:48
(Received via mailing list)
<select id="node_id" name="node[id]" onchange="document.location.href
= '/buildshelf/' + $F(&quot;node_id&quot;).value + ">
groovetrain (Guest)
on 2009-02-24 04:32
(Received via mailing list)
Can you see the problem there in the rendered HTML?

Groove
Chris H. (Guest)
on 2009-02-24 04:36
(Received via mailing list)
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:
<select id="node_id" name="node[id]" onchange="document.location.href
= '/buildshelf/' + $F('node_id').value + ">
groovetrain (Guest)
on 2009-02-24 05:27
(Received via mailing list)
couldn't you just do something like:

onchange="document.location.href = '/buildshelf/' + this.value"

Groove
Chris H. (Guest)
on 2009-02-24 05:33
(Received via mailing list)
Of course, but I would have to pull my head out of my butt first.  DOH!
This topic is locked and can not be replied to.