# Passing parameter to open dialog using link\_to\_function

**URL:** <https://www.ruby-forum.com/t/passing-parameter-to-open-dialog-using-link-to-function/177226>\
**Category:** Rails\
**Created:** [October 13, 2009, 8:03pm UTC](https://www.ruby-forum.com/t/passing-parameter-to-open-dialog-using-link-to-function/177226 "2009-10-13T20:03:06Z")\
**Posts on this page:** 2\
**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:** [October 13, 2009, 8:03pm UTC](https://www.ruby-forum.com/t/passing-parameter-to-open-dialog-using-link-to-function/177226/1 "2009-10-13T20:03:06Z")

</div>

Hello all,  
I’m having one fun time trying to past a parameter to a javascript  
function using link\_to\_function.

This is what I have…

1. A simple project, controller, views, model.
2. Prototype Window dialog box installed.

What I’m trying to do is on the index.html.erb, instead of link\_to  
“show”, project I’m using link\_to\_function “Show”, "project.show()’.  
I want to past the project.id to project.show(). If I do  
project.show(project.id), it blows up.

- index.html.erb -

\<%= javascript\_tag(“project = new Window({  
className: ‘alphacube’,  
title: ‘Project Details’,  
width:400,  
height:400,  
top:70,  
left:600  
});  
project.getContent().update(’

 foo bar 
');”  
) %\> \<% projects.each do |project| %\> \<% end %\> 

| CTSI Project DB |
| --- |
| Project ID | IRB ID | Title | Pi full name | Action |
| --- | --- | --- | --- | --- |
| \<%=h project.project\_id %\> | \<%=h project.irb\_id %\> | \<%=h truncate( project.title, :length =\> 20 ) %\> | \<%=h project.pi\_full\_name %\> | \<%= link\_to\_function 'View', 'project.show()' %\> |

Any help will be greatly appreciated.

JohnM

---

<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, 8:55pm UTC](https://www.ruby-forum.com/t/passing-parameter-to-open-dialog-using-link-to-function/177226/2 "2010-01-19T20:55:43Z")

</div>

I removed the Prototype window and went will jQuery UI Dialog instead.  
It was easier to work with and more examples in regards to what I’m  
trying to accomplish.

JohnM
