# Link\_to\_remote parameter

**URL:** <https://www.ruby-forum.com/t/link-to-remote-parameter/174405>\
**Category:** Rails\
**Created:** [August 26, 2009, 1:56pm UTC](https://www.ruby-forum.com/t/link-to-remote-parameter/174405 "2009-08-26T13:56:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RVince](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/4491bb/32.png) [@RVince](https://www.ruby-forum.com/u/RVince)\
**Post date:** [August 26, 2009, 1:56pm UTC](https://www.ruby-forum.com/t/link-to-remote-parameter/174405/1 "2009-08-26T13:56:08Z")

</div>

I have some javascript in a page whereby I can call:

alert(document.getElementById(“channelnotes”).options  
[document.getElementById  
(“channelnotes”).options.selectedIndex].value );

And get the value in a select box on my page (A very complicated  
derivation of a select box, which also lets me edit it)

I need that value as a parameter in a link\_to\_remote call from the  
same page:

\<%= link\_to\_remote image\_tag("/images/baloon2.gif"), {:url =\>  
{:controller =\> ‘channels’, :action =\> ‘speakass’} , :update =\>  
‘channelnotesfield’},:title =\> ‘Change whereabouts to what shows in  
“Notes” (above, right) for the associate listed in the dropdown  
below’, :type =\> “submit”,:style =\> “float: left;border-style: ridge;  
padding: 1px;” %\>

I want to pass the value obtained in javascript as :  
document.getElementById(“channelnotes”).options[document.getElementById  
(“channelnotes”).options.selectedIndex].value

to my link\_to\_remote call – in other words, in channels.speakass I  
want to be able to pick up the value of this.

I’ve tried it with :with, as :

:url =\>{:controller =\> ‘channels’, :action =\> ‘speakass’} , with  
=\>document.getElementById(“channelnotes”).options  
[document.getElementById(“channelnotes”).options.selectedIndex].value

But that just gives me an error. Can anyone tell me how I can obtain  
this value in the function I am invoking in my link\_to\_remote. Thanks,  
RVince
