# Submit input to params

**URL:** <https://www.ruby-forum.com/t/submit-input-to-params/160643>\
**Category:** Rails\
**Created:** [February 18, 2009, 1:46pm UTC](https://www.ruby-forum.com/t/submit-input-to-params/160643 "2009-02-18T13:46:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [February 18, 2009, 1:46pm UTC](https://www.ruby-forum.com/t/submit-input-to-params/160643/1 "2009-02-18T13:46:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [February 19, 2009, 2:23pm UTC](https://www.ruby-forum.com/t/submit-input-to-params/160643/2 "2009-02-19T14:23:44Z")

</div>

I used link\_to\_remote with the :submit option pointing to the parent of  
the input I want to submit (doesn’t have to be a form!).

\<% form\_for … do |f| %\>  
  
\<%= collection\_select … %\>  
\<%= link\_to\_remote… :submit =\> ‘inside\_form’ %\>

# rest of form fields

\<% end %\>

Hope this helps someone 🙂
