I have a form for a model, that has an auto-fill button based on
existing record. Basically you can choose if to duplicate an existing
record using a select list of the record already in the db.
This select list is inside the form for the new model, but I need to
somehow submit it in an independent manner from the rest of the form. I
was able to do this with observe_field, but I want to do it using a
button or link:
<% form_for @product, :url => { :action => ‘create’ } do -%>
<%= collection_select :product, :id, Product.find(:all), :id, :name %>
<%= link_to ‘fill form’, :url => { :action => ‘fill_form’ } %>
product fields
<% end %>
I’m having trouble catching the actual selection in the params[], and
I’d really appreciate help on this - thanks.