# \<%= observe\_field

**URL:** <https://www.ruby-forum.com/t/observe-field/117654>\
**Category:** Rails\
**Created:** [October 19, 2007, 12:01am UTC](https://www.ruby-forum.com/t/observe-field/117654 "2007-10-19T00:01:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vasure](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/7ea924/32.png) [@vasure](https://www.ruby-forum.com/u/vasure)\
**Post date:** [October 19, 2007, 12:01am UTC](https://www.ruby-forum.com/t/observe-field/117654/1 "2007-10-19T00:01:40Z")

</div>

hi i have one more Q its abt  
\<%= observe\_field

it is doing ajax post back when i check and uncheck the check box but  
its passing the value when i check the check box but not when i uncheck  
it,is there any way we could make it work so that it always sends  
value,i need this as i cant use 'check\_box\_tag ’ as i need to call a  
javascript code too as far as i know with ‘check\_box\_tag’ we cant call  
javascript and the remote function with it if we can please let me  
know…or please let me know how we can make observe field to return the  
value when the checkbox is unchecked too

Thanks

---

<div class="post-metadata">

**Author:** ![vasure](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/7ea924/32.png) [@vasure](https://www.ruby-forum.com/u/vasure)\
**Post date:** [October 19, 2007, 6:09pm UTC](https://www.ruby-forum.com/t/observe-field/117654/2 "2007-10-19T18:09:15Z")

</div>

you need to use hidden field with the same name before the check box. if  
the check box is checked it should override the value of the hidden  
field in the params hash . else the hidden field value will be taken.  
the rails helpers do this for you and do support means of including the  
javascript event attributes. see the api
