# Making a row a link?

**URL:** <https://www.ruby-forum.com/t/making-a-row-a-link/142960>\
**Category:** Rails\
**Created:** [July 13, 2008, 11:29pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960 "2008-07-13T23:29:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 13, 2008, 11:29pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/1 "2008-07-13T23:29:29Z")

</div>

How can I make a

 clickable, to invoke an action?

Thanks!

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 13, 2008, 11:39pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/2 "2008-07-13T23:39:52Z")

</div>

Not sure to understand what you mean but something like \<%=  
link\_to “your\_link” … %\>

On Jul 13, 11:29 pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 13, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/3 "2008-07-13T23:41:59Z")

</div>

Tranquiliste wrote:

> Not sure to understand what you mean but something like \<%=  
> link\_to “your\_link” … %\>
> 
> On Jul 13, 11:29 pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

I want the actual row to be clickable… but how do I invoke an action  
when on the onclick??

Thanks

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 7:12am UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/4 "2008-07-14T07:12:12Z")

</div>

Justin To wrote:

> Justin To wrote:
> 
> > Tranquiliste wrote:
> > 
> > > Not sure to understand what you mean but something like \<%=  
> > > link\_to “your\_link” … %\>
> > > 
> > > On Jul 13, 11:29 pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > 
> > I want the actual row to be clickable… but how do I invoke an action  
> > when on the onclick??
> > 
> > Thanks
> 
> I need something like this:
> 
> Thanks

This should work :

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 12:43am UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/5 "2008-07-14T00:43:22Z")

</div>

Justin To wrote:

> Tranquiliste wrote:
> 
> > Not sure to understand what you mean but something like \<%=  
> > link\_to “your\_link” … %\>
> > 
> > On Jul 13, 11:29 pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> I want the actual row to be clickable… but how do I invoke an action  
> when on the onclick??
> 
> Thanks

I need something like this:

Thanks

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 4:24pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/6 "2008-07-14T16:24:15Z")

</div>

how obtrusive 😛

On Jul 14, 6:12 am, nico Itkin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/7 "2008-07-14T18:08:22Z")

</div>

nico Itkin wrote:

> This should work :
> 
> Works great, but now I’m having trouble with the controller. In a  
> partial, I’m trying to replace\_html with another partial…
> 
> So I’ve got this in the first partial:  
> \<% for user in @users %\>  
> .  
> .  
> .  
> \<%= remote\_function :url=\>{:action=\>:show\_user\_detail, :id =\> user.email  
> } %\>  
> .  
> .  
> .
> 
> sdf 
> This has some problems. Firstly, It still displays 'sdf' even though I have display:none for the 
> , so what's wrong with that?
> 
> In my controller, I have this:
> 
> def show\_user\_detail  
> if(request.xhr?)  
> render :update do |rjs|  
> # :params[:id] ??? I’ve no clue if I did that right.  
> rjs.replace\_html :params[:id], :partial =\> ‘form’  
> end  
> else  
> redirect\_to\_index  
> end  
> end
> 
> Thanks for the help!

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/making-a-row-a-link/142960/8 "2008-07-14T18:14:53Z")

</div>

On 14 Jul 2008, at 17:08, Justin To wrote:

> So I’ve got this in the first partial:  
> \<% for user in @users %\>  
> .  
> .  
> .  
> \<%= remote\_function :url=\>{:action=\>:show\_user\_detail, :id =\>  
> user.email  
> } %\>  
> .  
> .  
> .

> You can’t have a div at the top level of a table like that. (in  
> addition you can’t use characters like @ in dom ids)
> 
> > ```
> > render :update do |rjs|
> > # :params[:id] ??? I've no clue if I did that right.
> > rjs.replace_html :params[:id], :partial => 'form'
> > 
> > ```
> 
> That should be params[:id]
> 
> Fred
