DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Ajax Style Radio Buttons

04.11.2007
| 11359 views |
  • submit to reddit
        Ajax radio buttons. update the page div when a radio button is pressed.

<div id="join">
        <p class="title">
      Sign-up
        </p>
   <% form_for :radio_join, :html => { :id => 'radio_join' } do %>
      <%= radio_button_tag :join_page, :member %> Member
      <%= radio_button_tag :join_page, :model %> Model
      <%= radio_button_tag :join_page, :photographer %> Photographer
    <% end -%>
<% form_for :user, @user, :url => {:action => 'save_free'} do |user_form| -%>
        <div class="info">
    <%= render :partial => 'common/user_form', :object => user_form %>
                <p class="alignright">
        <%= submit_tag 'JOIN', :class => 'inputSubmit' %>
                </p>
      <br />
      <br />
        </div>
  <% end -%>

     </div>
<%= observe_form :radio_join, :url => { :action => 'choose_page' }, :update => "join", :complete => "Element.show('join')", :frequency => "0.25" %>