# Passing form element value with link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675>\
**Category:** Rails\
**Created:** [May 5, 2008, 11:54am UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675 "2008-05-05T11:54:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 5, 2008, 11:54am UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675/1 "2008-05-05T11:54:37Z")

</div>

Hi  
i have form like

 \<%= text\_field\_tag 'transfer\_reason' %\> 
Should fill description
 \<%= link\_to\_remote "#{flow\_item.action\_name}", { :success =\> "modal\_window\_for\_transfer\_reason.close();", :failure =\> "$('description\_nil\_div').show( )", :url =\> { :action =\> :edit\_service\_desk\_status\_after\_transfer, :sd\_id =\> @sd\_ticket.id, :status\_id =\> flow\_item.flow\_item\_id, } }, :class =\> "itlink1"%\> 

How can I pass the text\_field transfer\_reason with link\_to\_remote

Thanks in advance  
Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 5, 2008, 12:03pm UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675/2 "2008-05-05T12:03:03Z")

</div>

On 5 May 2008, at 10:54, Sijo Kg wrote:

> How can I pass the text\_field transfer\_reason with link\_to\_remote

Use the :with option

Fred

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 5, 2008, 12:03pm UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675/3 "2008-05-05T12:03:33Z")

</div>

use the :with parameter:  
[http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000958](http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000958)

something like:  
:with =\> “‘transfer\_reason=’ + $(‘transfer\_reason’).value”  
should work

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 5, 2008, 12:18pm UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675/4 "2008-05-05T12:18:10Z")

</div>

Hi  
Thanks for your help…I could solve with :submit option of  
link\_to\_remote

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 5, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/passing-form-element-value-with-link-to-remote/136675/5 "2008-05-05T17:03:08Z")

</div>

:with is good for one or two fields; :submit is better if you have an  
HTML container (e.g., div) that contains several input elements that  
need to be submitted.

If you’re still rendering input forms in tables, you could use the  
table or tablerow as the container. It might be good for the long-  
term maintenance of the project to pick one way and favor that even if  
it is less than optimal for one or two instances.
