# Radio\_button\_tag checked='checked'

**URL:** <https://www.ruby-forum.com/t/radio-button-tag-checked-checked/169258>\
**Category:** Rails\
**Created:** [June 1, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/radio-button-tag-checked-checked/169258 "2009-06-01T15:37:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chetan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f05b48/32.png) [@chetan](https://www.ruby-forum.com/u/chetan)\
**Post date:** [June 1, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/radio-button-tag-checked-checked/169258/1 "2009-06-01T15:37:37Z")

</div>

Hello,

I have 3 radio buttons,

\<%= radio\_button\_tag(‘method’, ‘auto’, checked = ‘checked’,  
options = {:onclick =\> “Element.show(‘avsAutoWrapper’);  
Element.hide(‘avsCustomWrapper’); Element.hide(‘avsLocalWrapper’);”})  
%\>Auto

\<%= radio\_button\_tag(‘method’, ‘custom’, checked = false,  
options = {:onclick =\> “Element.hide(‘avsAutoWrapper’);  
Element.show(‘avsCustomWrapper’); Element.hide(‘avsLocalWrapper’);”})  
%\>Custom

\<%= radio\_button\_tag(‘method’, ‘local’, checked = false,  
options = {:onclick =\> “Element.hide(‘avsAutoWrapper’);  
Element.hide(‘avsCustomWrapper’); Element.show(‘avsLocalWrapper’);”})  
%\>Local

Every radio button has its respective text field.  
I want radio button Auto to be checked default.

And these are their

's
\<%= render(:partial =\> "a\_b\_auto", :object =\> @product\_build) %\>

\<%= render(:partial =\> "a\_b\_custom", :object =\> @Product\_build) %\>

\<%= render(:partial =\> "a\_b\_local", :object =\> @product\_build) %\>

Now when the application starts and the page containing this three radio  
buttons display at the very first time,I can see all the three text  
fields of all of these radio buttons,which I don’t want.

Just the text field of respective radio button must be displayed.  
But this is not happening…  
I had also tried the following format of radio buttons

\<%= radio\_button\_tag(‘method’, ‘local’, checked = true,  
options = {:onclick =\> “Element.hide(‘avsAutoWrapper’);  
Element.show(‘avsCustomWrapper’); Element.hide(‘avsLocalWrapper’);”})  
%\>Custom

and

\<%= radio\_button\_tag(‘method’, ‘local’, true,  
options = {:onclick =\> “Element.hide(‘avsAutoWrapper’);  
Element.show(‘avsCustomWrapper’); Element.hide(‘avsLocalWrapper’);”})  
%\>Custom

but it wont work.

Please help me.

Thanks

Chetan.
