# Div updating on checking a radio button

**URL:** <https://www.ruby-forum.com/t/div-updating-on-checking-a-radio-button/189307>\
**Category:** Rails\
**Created:** [May 28, 2010, 1:46pm UTC](https://www.ruby-forum.com/t/div-updating-on-checking-a-radio-button/189307 "2010-05-28T13:46:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swetha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@swetha](https://www.ruby-forum.com/u/swetha)\
**Post date:** [May 28, 2010, 1:46pm UTC](https://www.ruby-forum.com/t/div-updating-on-checking-a-radio-button/189307/1 "2010-05-28T13:46:51Z")

</div>

I have a problem in updating a div ,when a radio is checked.

## new.html.erb
\<% form\_for @account, :url =\> account\_path do |f| %\> \<%= f.error\_messages %\> \<%= render :partial =\> "form", :object =\> f %\> \<%= f.submit "Register" %\> \<% end %\>
## \_form.html.erb

\<%= form.label :first\_name %\>  
\<%= form.text\_field :first\_name%\>

\<%= form.label :last\_name %\>  
\<%= form.text\_field :last\_name %\>

\<%= form.label :account\_type %\> \<%= radio\_button\_tag('account\_type', "Free",checked = false ,options ={:onclick =\> "Element.show('free'); Element.hide('premium');"}) %\> Free \<%= radio\_button\_tag('account\_type',"Premium", checked = false,options ={:onclick =\> "Element.show('premium'); Element.hide('free');"}) %\> Premium

Enter your subdomain name

\<%= form.label :subdomain %\> www.example.in/\<%= form.text\_field :subdomain %\>

 Free Your wed-site name 

\<%= @subdomain%\>

When a user gives his firstname and last name and check a radio button  
as free ,then the both his first and last names should combine and  
come in subdomain field.  
So can we give any action name in radio button tag and perform the  
action.  
And if he selects premium,then we subdomain name should be user  
choice.

so i need to do it by ajax or without ajax , i struggled alot but i  
could not a solution.  
Anyone help me getting out of this…Thanks in Advance.
