All pastes #896339 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-08 15:52 UTC
rendered paste body
controller whatever 

  def index
  end

  def get_correct_form
    if params[:your_value_from_the_select_in_index_view] == 'teacher'
      partial_to_load = "teacher"
    end


    render :partial => partial_to_load   
  end
end


your index view :  
<select name="our_value_from_the_select_in_index_view" id="our_value_from_the_select_in_index_view">
  <option>Please select...</option>
  <option value="teacher">Teacher</option>
</select>

<%= observe_field(:our_value_from_the_select_in_index_view
      :url => { :action => :get_correct_form }),
      :frequency => 0.5,
      :update => "form_contents",
      :with => 'query'
%>

<div id="form_contents">
</div>