Rails: Transmit <select><option> value into link_to()

P

Phlip

[Still trying to safely get on the Rails mailing list...]

Rubies:

The great thing about Web programming is there's so many languages to chose
from - or mix together.

Specifically, an ERb page can contain 3 languages:

<select id="myList">
<% for record in @table %>
<option value="<%= record.id %>"><%= h(record.name) %></option>
<% end %>
</select>

Okay, that's a combobox with names and values in it.

Now how do I let the user select one option, and send it to the next page
with link_to()?

<%= link_to 'Go to Next Page',
{:action => 'goToNextPage', :id => ??? }
%>

The third potential language is JavaScript, so in theory I could add an
onclick event to each <option>, or similar, then express the link_to in raw
HTML...

<a id="linkOut" href="/page/goToNextPage/2">Go to Next Page</a>

....then use the onclick event to change the href attribute.

However, that's not very Railish, and I'm sure there's some feature
available which my newbescence has overlooked!
 
W

William Crawford

Phlip said:
[Still trying to safely get on the Rails mailing list...]

Do you mean to say you meant this to go there? It... didn't.
The great thing about Web programming is there's so many languages to
chose
from - or mix together.

Not to be mean, but... Isn't that true about all programming?
Especially with the .NET CLR and it's ability to interoperate between
languages easily. I see this as being huge eventually. (Ruby has a gem
that allows you to use .NET libraries, and of course C libraries... So
it's already walking down this path. And I'm very much looking forward
to Ruby.NET.)
 
P

Phlip

William said:
[Still trying to safely get on the Rails mailing list...]

Do you mean to say you meant this to go there? It... didn't.

I didn't say that.

I mean when I tried to register before nothing happened, and when I try to
register today I get this:

http://lists.rubyonrails.org/mailman/subscribe/rails

blah blah blah

IOError: [Errno 28] No space left on device

I'm tormented with the urge to blame Python, but the problem is apparently
the drive filled up with mail!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top