I have 3 text fields in a form , all with the same method, since those params will be inserted via a loop which is set up in the create action. However, I’m noticing that the form is only sending through the 1st value and leaving out the additional 2.
In my form I have this: <%= text_field(:cantitle, :title_opt)%> <%= text_field(:cantitle, :title_opt)%> <%= text_field(:cantitle, :title_opt)%>
Even though I put input into each , the params came through as such:
{“cantitle”=>{“title_opt”=>“CEO”}, # so the 2nd and 3rd were skipped.
In the controller I have this loop- # which if 3 values were submitted , 3 records would be created. a = (params[:cantitle][:title_opt]) a.each {|x| cantitle = Cantitle.new cantitle.title_opt = x cantitle.save }
Any ideas how to get each value through ? Also, I’m wondering what would happen if someone filled in the 1st and 3rd box and left the 2nd blank. Do I have to account for a null value ?
Stuart