Div updating on checking a radio button

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.