palani
palani

Reputation: 4679

Rails 3.0 . How to pass the select box value through link_to

I knew that Rails3 no longer supporting link_to_remote.... instead of that we can modify the link_to method by using different syntax as follows :

link_to "Send",{:action =>"send_mail",:question_id =>question.id},:remote => true,:class =>"button small"

My problem is, in my view i keep the select box which contains the list of user's name near by send link button (which user the above syntax)... i want to pass the selection box value to link_to when user click the send button

Here is my View code :

"send_mail",:question_id =>question.id,:user_value =>encodeURIComponent($F('user_id'))},:remote => true,:class =>"button small" %>

I don't know how to achieve this ....can any one please suggest me on this.

Upvotes: 0

Views: 1836

Answers (1)

DrColossos
DrColossos

Reputation: 12998

edit: ok now is see your last comment... never mind

What I got from the question, you are looking for something like this:

http://marcgrabanski.com/articles/jquery-select-list-values

It's not really a Rails problem since you can't change the Ruby code from within the rendered HTML (at least that would be very risky if it's possible). The code from above can be easily changed to your needs so that the user gets redirected to the URL that matches the button value.

Upvotes: 0

Related Questions