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(''<div> foo bar
</div>'');"
) %>
<table class="searchResults">
<tr><th colspan="6">CTSI Project
DB</th></tr>
<tr>
<th>Project ID</th>
<th>IRB ID</th>
<th>Title</th>
<th>Pi full name</th>
<th colspan="2">Action</th>
</tr>
<% projects.each do |project| %>
<tr onclick="highLightTR(this,''#ccc'',
''#000'');">
<td><%=h project.project_id %></td>
<td><%=h project.irb_id %></td>
<td><%=h truncate( project.title, :length => 20 )
%></td>
<td><%=h project.pi_full_name %></td>
<td style="text-align:center;"><%= link_to_function
''View'',
''project.show()'' %></td>
</tr>
<% end %>
</table>
Any help will be greatly appreciated.
JohnM
--
Posted via http://www.ruby-forum.com/.
John Mcleod
2010-Jan-19 19:55 UTC
Re: Passing parameter to open dialog using link_to_function
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.