Updating a form.select based whenever another form.select change [ajax]

I have the following form :

<% form_for :registration, @registration, :url => { :action =>
“create” } , :html => {:class => ‘generalform’} do |form| %>
<%= render :partial => “form”, :object => form %>
<%= form.submit “Register”, :class => ‘go’ %> <%= link_to
‘Cancel’, registrations_path %>
<% end %>

with this partial : (2 form select)

<%= form.label :trainee %>
<%= form.select(:trainee_id, @trainees.map {|s| [s.name, s.id]}, {:include_blank => '- select a trainee -' }, :style => "width: 200px;", :onchange => remote_function( :method => "post", :with => "'trainee_id=' + value", :url => choose_registrations_path ) )%>
<%= form.label :educational_path %>
<%= form.select(:epath_id, @epaths.map {|g| [g.kp_path_name, g.id]}, {:include_blank => '- select an educational path -' }, :style => "width:200px;" ) %>

whenever the first select change (trainee) an Ajax request is fired
(remote_function) and the choose action in controller registrations is
executed … working well , based on the trainee _id , an array
@epaths should be displayed in the second form.select…

I I put the second select in a partial, I loose the form

should I write ALL the form in a select a refresh it, or can I refresh
only the 2 select ?

thanks for your help

erwin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs