# Get value of checkbox

**URL:** <https://www.ruby-forum.com/t/get-value-of-checkbox/147478>\
**Category:** Rails\
**Created:** [September 2, 2008, 9:40am UTC](https://www.ruby-forum.com/t/get-value-of-checkbox/147478 "2008-09-02T09:40:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johdax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@johdax](https://www.ruby-forum.com/u/johdax)\
**Post date:** [September 2, 2008, 9:40am UTC](https://www.ruby-forum.com/t/get-value-of-checkbox/147478/1 "2008-09-02T09:40:25Z")

</div>

hi,  
i need to pass the value of a checkbox (simple boolean value 0/1) to a  
rails action. how do i do that. the value has nothing todo with any  
model used. i just want to pass the priority the mail should be sent,  
without storing this value in the model. here my code

**Urgent: \<%= check\_box “priority”, 1, 0) %\>  
…  
 Body:**  
  
**…**

\<%= link\_to ‘Send’, :controller =\> “newsletters”, :action =\>  
“sendmails”, :id =\> @newsletter, :priority =\> priority %\>  
…

is there some way which includes javascript? i have no form tag wrapped  
around the code, because its in the show.erb.

thanks in advance

---

<div class="post-metadata">

**Author:** ![johdax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@johdax](https://www.ruby-forum.com/u/johdax)\
**Post date:** [September 2, 2008, 10:31am UTC](https://www.ruby-forum.com/t/get-value-of-checkbox/147478/2 "2008-09-02T10:31:21Z")

</div>

On Sep 2, 8:40 am, John D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<%= link\_to ‘Send’, :controller =\> “newsletters”, :action =\>  
> “sendmails”, :id =\> @newsletter, :priority =\> priority %\>  
> …
> 
> is there some way which includes javascript? i have no form tag wrapped  
> around the code, because its in the show.erb.

You’re really better off sticking a form in there - it’s by far the  
easiest way to do this, it is after all what forms were designed to  
do.

Fred
