# Link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/link-to-remote/113877>\
**Category:** Rails\
**Created:** [September 5, 2007, 9:29pm UTC](https://www.ruby-forum.com/t/link-to-remote/113877 "2007-09-05T21:29:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasiu85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@jasiu85](https://www.ruby-forum.com/u/jasiu85)\
**Post date:** [September 5, 2007, 9:29pm UTC](https://www.ruby-forum.com/t/link-to-remote/113877/1 "2007-09-05T21:29:07Z")

</div>

Hey,

I’m trying to create AJAX website with Rails. I ran into the following  
problem:

I want to add a Song to my database. There is this \_form.rhtml where I  
can edit all Song’s attributes. Then I can click ‘Create’ and I’m  
done. I want to switch this to AJAX. I thought about using  
form\_remote\_tag, but it seems insufficient to me. One of Song’s  
attributes is a list of lyrics authors. I edit this list as follows:  
you can enter new author in a text field and press ‘Add’ or you can  
click ‘Remove’ on any of existing authors. Unfortunately, to implement  
this I’d have to use another remote form and I would land with nested

 tags, which is prohibited. So... I think that maybe I could use link\_to\_remote or remote\_function, but... I would somehow have to pull out text field values and send them as parameters of the link\_to\_remote. Can I do that? And how?

Thanks,

Mike

---

<div class="post-metadata">

**Author:** ![jasiu85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@jasiu85](https://www.ruby-forum.com/u/jasiu85)\
**Post date:** [September 6, 2007, 12:15am UTC](https://www.ruby-forum.com/t/link-to-remote/113877/2 "2007-09-06T00:15:21Z")

</div>

you can change form action to different by javascript…

with :  
link\_to “button”, “#”, :onclick = “document.forms.myform.action = ‘/  
new/action’;”

OR if i am lost something:  
you have Song.authors model ?  
you can pass:  
hidden\_field “song”, “authors[]”, @song.authors  
in this way ^.

---

<div class="post-metadata">

**Author:** ![jasiu85](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@jasiu85](https://www.ruby-forum.com/u/jasiu85)\
**Post date:** [September 6, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/link-to-remote/113877/3 "2007-09-06T20:00:53Z")

</div>

Hmm, maybe my description was too complicated… I need this:

I have an in my page and I want to  
include it’s value in an XML-RPC call performed by link\_to\_remote. How  
can I do that?

Regards,

Mike
