I have a problem in updating a div ,when a radio is checked.
new.html.erb
-------------------
<fieldset>
<% form_for @account, :url => account_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Register" %>
<% end %>
</fieldset>
_form.html.erb
----------------------
<p>
<%= form.label :first_name %><br />
<%= form.text_field :first_name%>
</p>
<p>
<%= form.label :last_name %><br />
<%= form.text_field :last_name %>
</p>
<p><%= 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
</P>
<div id = "premium" style="display:none">
Enter your subdomain name
<p>
<%= form.label :subdomain %>
www.example.in/<%= form.text_field :subdomain %>
</p>
</div>
<div id = "free" style="display:none">
Free
Your wed-site name <p id="site_url"><%= @subdomain%></p>
</div>
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.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment