I have two select tags as follow
<%= f.select(:floor_id, ProjectFloor.find(:all,:order => "name ASC",:conditions => ["project_id = ?", @project.id]).collect{|b|[b.name, b.id]}, {:include_blank => 'Select'}) %>
<%= f.select(:unit_id, @floor.collect{|b|[b.name, b.id]}, {:include_blank => 'Select'}) %>
When the user select the value on the first select tag called :floor_id
then the value of the select tag data should be load to :unit_id
select tag
I have try the following to read and fetch the data but. the floor_id always receiving null
My controller method is as follow :
@floor_id = params[:floor_id]
@project = Project.find(params[:project_id])
@proposed_customer = ProposedCustomer.new
@floor = ProjectFloorUnit.select_units(@project.id, @floor_id)
The select unit method is work fine for static values so it must work if we pass the proper param.
Thanks in advances
Aucun commentaire:
Enregistrer un commentaire