1. new.rhtml <h1>New pr_cate</h1> <%= javascript_include_tag ''prototype'' %> <% form_for(@pr_cate) do |f| %> <%= f.error_messages %> <p> <%=f.select(:id, @pr_cates.map {|u| [u.name,u.id]}, {:onchange => remote_function( :with => "''id=''+value", :method => "get", :update => ''next_select'', :url => { :action => :new } ) } )%> <div id=''next_select''> <%= render(:partial => "test") %> </div> ... 2. controller def new if params[:id] @pr_cates = PrCate.find(:all, :conditions => ["parent_id = ?", params[:id]]) else @pr_cates = PrCate.find(:all, :conditions => ["parent_id = ?", "0"]) end @pr_cate = PrCate.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @pr_cate } end end 3. _test.rhtml <%= select("pr_cate","id", @pr_cates.map {|u| [u.name,u.id]}) %> Now the second drop list is not working correct. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---