# Help with radio buttons

**URL:** <https://www.ruby-forum.com/t/help-with-radio-buttons/82730>\
**Category:** Rails\
**Created:** [January 20, 2007, 2:10am UTC](https://www.ruby-forum.com/t/help-with-radio-buttons/82730 "2007-01-20T02:10:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 20, 2007, 2:10am UTC](https://www.ruby-forum.com/t/help-with-radio-buttons/82730/1 "2007-01-20T02:10:33Z")

</div>

I need some general help with radio buttons. Here is what I want to do:

I need two radio buttons which correspond to a tinyint column in the  
DB. I want the radio buttons to be pre-selected to the DB value. When a  
user changes the selection, I want the changes reflected in the DB  
without clicking on any buttons.

I have found in\_place\_control plugin but can’t figure out how to use  
it/install it. I can create the buttons - but they are not pre-selected  
and I am not sure how to do the update.

Help is much appreciated - code examples are great. I have the books  
and have read the api - so if that is your advice don’t bother.

---

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 20, 2007, 2:35pm UTC](https://www.ruby-forum.com/t/help-with-radio-buttons/82730/2 "2007-01-20T14:35:33Z")

</div>

If you use the check\_box helper, the default value (set in the database  
itself) should be selected on new records, and the actual value if it’s  
an existing record.

---

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 22, 2007, 3:57am UTC](https://www.ruby-forum.com/t/help-with-radio-buttons/82730/3 "2007-01-22T03:57:45Z")

</div>

OK - but when a user makes a selection I want the value reflected in  
the DB with out forcing the user to then click a button. I have read up  
on observe field - but my understanding is that it does not work with  
radio buttons. Any suggestions?

Thanks, K

On Jan 20, 5:35 am, “removed\_email\_address@domain.invalid”

---

<div class="post-metadata">

**Author:** ![kim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kim](https://www.ruby-forum.com/u/kim)\
**Post date:** [January 22, 2007, 4:08am UTC](https://www.ruby-forum.com/t/help-with-radio-buttons/82730/4 "2007-01-22T04:08:47Z")

</div>

Kim wrote:

> > itself) should be selected on new records, and the actual value if it’s
> > 
> > > I have found in\_place\_control plugin but can’t figure out how to use  
> > > it/install it. I can create the buttons - but they are not pre-selected  
> > > and I am not sure how to do the update.
> > 
> > > Help is much appreciated - code examples are great. I have the books  
> > > and have read the api - so if that is your advice don’t bother.

Add on ‘onClick’ helper that fires off a remote\_function call that  
updates the database.

\_Kevin
