# Getting & validating check\_box input in button\_to\_function

**URL:** <https://www.ruby-forum.com/t/getting-validating-check-box-input-in-button-to-function/161400>\
**Category:** Rails\
**Created:** [February 26, 2009, 7:33am UTC](https://www.ruby-forum.com/t/getting-validating-check-box-input-in-button-to-function/161400 "2009-02-26T07:33:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnyplz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f17d59/32.png) [@tnyplz](https://www.ruby-forum.com/u/tnyplz)\
**Post date:** [February 26, 2009, 7:33am UTC](https://www.ruby-forum.com/t/getting-validating-check-box-input-in-button-to-function/161400/1 "2009-02-26T07:33:10Z")

</div>

Hi all,

Given below is a snippet of my ruby page.  
While clicking on the Edit/Delete buttons, it should:

1. Identify how many chk boxes are checked (If Edit, it should be one)
2. Pass the chk box values (project ids) to the controller methods

## I ended up nowhere. Please help me correct the code.
 Select Name Code Description Manager Manager Email \<% chkId = Array.new %\> \<% i = 0 %\> \<% for project in @projects %\> \<% i = i+1 %\>\<% chkId[i] = project.id.to\_s %\>\<%= check\_box\_tag(chkId[i]) %\> \<%=h project.proj\_name %\> \<%=h project.proj\_code %\> \<%=h project.proj\_desc %\> \<%=h project.manager %\> \<%=h project.mgr\_email %\> \<% end %\> \<%= button\_to\_function '&nbsp;Create&nbsp;', remote\_function(:update=\>"project\_creation", :url=\>{:action=\>'project\_creation'}) %\> \<%= button\_to\_function '&nbsp;Edit&nbsp;', remote\_function(:update=\>"project\_update", :url=\>{:action=\>'project\_update'}), :before =\> "isSingleSelection()" %\> \<%= button\_to\_function '&nbsp;Delete&nbsp;', remote\_function(:update=\>"admin\_project", :url=\>{:action=\>'delete\_project'}, :confirm=\>"Are you sure?", :method=\>"delete") %\> 

Do appreciate your help.

Thanks,

Tony P.
