# Link\_to :with functionality

**URL:** <https://www.ruby-forum.com/t/link-to-with-functionality/142328>\
**Category:** Rails\
**Created:** [July 6, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/link-to-with-functionality/142328 "2008-07-06T21:53:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [July 6, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/link-to-with-functionality/142328/1 "2008-07-06T21:53:25Z")

</div>

I’m trying to pass the argument from a select box with a link\_to call.  
This works with link\_to\_remote, but i absolutely cannot use ajax in this  
situation. What is the correct way to pass my select\_tag argument as a  
parameter in my link\_to?

\<%= link\_to “C”, :action =\> ‘a\_z’, :ltr =\> “C”, :with =\> “‘a\_z\_language  
=’+$(‘selectbox’).value” %\>|

\<%= select\_tag(:selectbox,options\_for\_select([“Chinese”, “Dutch”,  
“English”, “French”,“German”,“Greek”, “Italian”, “Japanese”, “Korean”,  
“Portuguese”, “Russian”,“Spanish”], @default)) %\>

RETURNS\>  
with: “‘a\_z\_language =’+$(‘selectbox’).value”

INSTEAD OF\>  
with: “English”

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [July 7, 2008, 12:22am UTC](https://www.ruby-forum.com/t/link-to-with-functionality/142328/2 "2008-07-07T00:22:22Z")

</div>

On Jul 6, 8:53 pm, Richard S. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> I’m trying to pass the argument from a select box with a link\_to call.  
> This works with link\_to\_remote, but i absolutely cannot use ajax in this  
> situation. What is the correct way to pass my select\_tag argument as a  
> parameter in my link\_to?

A form would be the easiest way (if you have to have a link you could  
have the link’s onclick be someForm.submit()).

Fred.

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [July 7, 2008, 12:40am UTC](https://www.ruby-forum.com/t/link-to-with-functionality/142328/3 "2008-07-07T00:40:24Z")

</div>

Frederick C. wrote:

> On Jul 6, 8:53ï¿½pm, Richard S. \<rails-mailing-l…@andreas-  
> [s.net](http://s.net)\> wrote:
> 
> > I’m trying to pass the argument from a select box with a link\_to call.  
> > This works with link\_to\_remote, but i absolutely cannot use ajax in this  
> > situation. What is the correct way to pass my select\_tag argument as a  
> > parameter in my link\_to?
> 
> A form would be the easiest way (if you have to have a link you could  
> have the link’s onclick be someForm.submit()).
> 
> Fred.

a form wouldn’t work for my particular application, i really need to  
pull out the values from one field and use put those values in the  
parameters of a link\_to call. Thanks Though.

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [July 7, 2008, 1:09am UTC](https://www.ruby-forum.com/t/link-to-with-functionality/142328/4 "2008-07-07T01:09:09Z")

</div>

On Jul 6, 11:40 pm, Richard S. \<rails-mailing-l…@andreas-  
[s.net](http://s.net)\> wrote:

> Frederick C. wrote:
> 
> > A form would be the easiest way (if you have to have a link you could  
> > have the link’s onclick be someForm.submit()).
> 
> > Fred.
> 
> a form wouldn’t work for my particular application, i really need to  
> pull out the values from one field and use put those values in the  
> parameters of a link\_to call. Thanks Though.

I suppose you could do something really fugly where in the link’s  
onclick you modify this.href (ie what the link points at) and then  
return true (so that the event processing continues). I’d be very  
surprised if you couldn’t coerce a form to do what you need.

Fred
