# Get values

**URL:** <https://www.ruby-forum.com/t/get-values/143107>\
**Category:** Rails\
**Created:** [July 15, 2008, 10:53am UTC](https://www.ruby-forum.com/t/get-values/143107 "2008-07-15T10:53:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lexor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lexor](https://www.ruby-forum.com/u/lexor)\
**Post date:** [July 15, 2008, 10:53am UTC](https://www.ruby-forum.com/t/get-values/143107/1 "2008-07-15T10:53:13Z")

</div>

Hi all,

I have a web with a table which list the values of a model and I want to  
add a toolbar for edit, show and delete a row.

I have added OnClick event that calls a JavaScript method to highligth  
the selected row and I want to get the ID of that selected row to pass  
to the buttons (each button have a Link\_to) in the toolbar to launch the  
action to the ID selected.

Somebody knows how can I do this?

Thanks in advance for your help  
Lexor

---

<div class="post-metadata">

**Author:** ![lexor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lexor](https://www.ruby-forum.com/u/lexor)\
**Post date:** [July 15, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/get-values/143107/2 "2008-07-15T17:10:33Z")

</div>

On Tue, Jul 15, 2008 at 1:53 AM, Lexor Man  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have added OnClick event that calls a JavaScript method to highligth  
> the selected row and I want to get the ID of that selected row to pass  
> to the buttons (each button have a Link\_to) in the toolbar to launch the  
> action to the ID selected.
> 
> Somebody knows how can I do this?

Do what? If you have an onclick event handler already configured,  
you have the event target object – if that’s not the selected row, then  
it must have some relationship to the row.

IOW, you’re changing the style (or className, or something) of the  
row – so you already have access to the object (row) id.

Unless I haven’t had enough coffee and totally misunderstand 🙂

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![lexor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lexor](https://www.ruby-forum.com/u/lexor)\
**Post date:** [July 21, 2008, 6:06pm UTC](https://www.ruby-forum.com/t/get-values/143107/3 "2008-07-21T18:06:08Z")

</div>

Hassan S. wrote:

> On Tue, Jul 15, 2008 at 1:53 AM, Lexor Man  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I have added OnClick event that calls a JavaScript method to highligth  
> > the selected row and I want to get the ID of that selected row to pass  
> > to the buttons (each button have a Link\_to) in the toolbar to launch the  
> > action to the ID selected.
> > 
> > Somebody knows how can I do this?
> 
> Do what? If you have an onclick event handler already configured,  
> you have the event target object – if that’s not the selected row, then  
> it must have some relationship to the row.
> 
> IOW, you’re changing the style (or className, or something) of the  
> row – so you already have access to the object (row) id.
> 
> Unless I haven’t had enough coffee and totally misunderstand 🙂
> 
> ## FWIW,
> 
> Hassan S. ------------------------ removed\_email\_address@domain.invalid

Hi Hassan,

Thanks for your reply, but nevermind, I decided to do other stuff.

Thanks and Regards  
Lexor
