# Link\_to\_remote with javascript to fetch multiple checkboxes

**URL:** <https://www.ruby-forum.com/t/link-to-remote-with-javascript-to-fetch-multiple-checkboxes/166552>\
**Category:** Rails\
**Created:** [April 27, 2009, 9:49am UTC](https://www.ruby-forum.com/t/link-to-remote-with-javascript-to-fetch-multiple-checkboxes/166552 "2009-04-27T09:49:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkbeili](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tkbeili](https://www.ruby-forum.com/u/tkbeili)\
**Post date:** [April 27, 2009, 9:49am UTC](https://www.ruby-forum.com/t/link-to-remote-with-javascript-to-fetch-multiple-checkboxes/166552/1 "2009-04-27T09:49:31Z")

</div>

Hello,

I’m trying to submit a link using:

\<%= link\_to\_remote "&nbsp;&nbsp;add selected",  
:html =\>{:id =\> ‘multiple\_select\_form’},  
:url =\> { :controller =\> “sms”,  
:action =\> “add\_selected\_to\_recipients\_list”,  
:recipients\_session\_id =\> @recipientSessionID},  
:with =\> "‘checked\_client\_array=’+  
document.getElementsByName(‘checked\_client\_array’) "  
%\>

where checked\_client\_array is a name of a list of checkboxes such as is:

what I get inside Rails console:

{“checked\_client\_array”=\>"[object HTMLCollection]",  
“recipients\_session\_id”=\>“recipients\_list”}

if I put the boxes inside regular form it works fine by I want to be  
submitted from another form so that’s why I’m using the :with property  
for the remote link.

Any ideas what I’m doing wrong and how I can submit it regularly.

Thanks,

TAm

---

<div class="post-metadata">

**Author:** ![tkbeili](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/7bcc69/32.png) [@tkbeili](https://www.ruby-forum.com/u/tkbeili)\
**Post date:** [April 27, 2009, 10:14am UTC](https://www.ruby-forum.com/t/link-to-remote-with-javascript-to-fetch-multiple-checkboxes/166552/2 "2009-04-27T10:14:16Z")

</div>

On Apr 27, 8:49 am, Tam K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> document.getElementsByName(‘checked\_client\_array’) "  
> %\>

Your with clause should evaluate to a query string fragment (ie  
name1=value1&name2=value2 etc…), which it doesn’t in your case -  
you’ve just got some DOM collection or something like that. You need  
to construct an appropriate query string fragment from that  
collection. Prototype has various helpers for dealing with this (eg  
serialize).

Fred
