# Passing parameter thru fields\_for text\_field

**URL:** <https://www.ruby-forum.com/t/passing-parameter-thru-fields-for-text-field/181900>\
**Category:** Rails\
**Created:** [January 19, 2010, 10:24pm UTC](https://www.ruby-forum.com/t/passing-parameter-thru-fields-for-text-field/181900 "2010-01-19T22:24:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [January 19, 2010, 10:24pm UTC](https://www.ruby-forum.com/t/passing-parameter-thru-fields-for-text-field/181900/1 "2010-01-19T22:24:35Z")

</div>

Hello all,

I have a helper function called “add\_link” which will insert html to a  
partial.

- ProjectsHelper -  
def add\_link(name, irb=nil)  
link\_to\_function name do |page|  
page.insert\_html :top, :irbs, :partial =\> ‘projects/irb’, :object  
=\> Irb.new, :locals =\> { :irb\_id =\> irb }  
end  
end

- \_irb.html.erb -

 \<% new\_or\_existing = irb.new\_record? ? 'new' : 'existing' %\> \<% prefix = "project[#{new\_or\_existing}\_irb\_attributes][]" %\> \<% error\_messages\_for :irb %\> 

\<% fields\_for prefix, irb do |irb\_form| -%\>

\<%= irb\_form.text\_field "IRB" %\>

```
<%= link_to_function "remove", "jQuery(this).fadeOut(500, function()

```

{ $(this).up(’.irb’).remove(); } );" %\>

 \<% end -%\>

How can I pass an id to the text field like the “\<%= text\_field\_tag  
“IRB”, irb\_id %\>”

I would like to display the IRB value in the text field when inserted.

Thanks for any help with this.

JohnM
