# Getting another dom element value

**URL:** <https://www.ruby-forum.com/t/getting-another-dom-element-value/138745>\
**Category:** Rails\
**Created:** [May 27, 2008, 11:43am UTC](https://www.ruby-forum.com/t/getting-another-dom-element-value/138745 "2008-05-27T11:43:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 27, 2008, 11:43am UTC](https://www.ruby-forum.com/t/getting-another-dom-element-value/138745/1 "2008-05-27T11:43:03Z")

</div>

Hi  
I have a code in view like below…Here I am using Control.modl  
windows

 Primary Assignee Group \<%= text\_field "dummy\_service\_desk\_ticket", "dummy\_primary\_assignee\_group", "size" =\> 30, :readonly =\> "readonly" %\>&nbsp;[Select](#pop_primary_assignee_group) Assignee \<%= text\_field "sd\_ticket", "primary\_assignee", "size" =\> 30, :readonly =\> "readonly" %\> [Select](#pop_primary_assignee)

```
 As you can see there are 2 Buttons 'Select'.When i click on the

```

first select a search UI comes in the modal window and the result of  
search is shown on the same popup window.And when i click on one record  
in the window its value will be set on the text field by javascript and  
its id goet to the hiddenfield.  
\<%= hidden\_field “sd\_ticket”, “primary\_assignee\_group\_id” %\>  
So my problem is when i click on the second select how can i get this  
value…I tried like  
\<%= puts $(‘sd\_ticket\_primary\_assignee\_group\_id’).value %\> But  
getting error.

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 27, 2008, 11:57am UTC](https://www.ruby-forum.com/t/getting-another-dom-element-value/138745/2 "2008-05-27T11:57:54Z")

</div>

On 27 May 2008, at 10:43, Sijo Kg wrote:

> value…I tried like  
> \<%= puts $(‘sd\_ticket\_primary\_assignee\_group\_id’).value %\> But  
> getting error.

Think about that: you’re trying to write some ruby code (ie that runs  
on the server) to access something that exists only on the browser.  
That can’t possibly ever work. In a chunk of javascript $F(‘some\_id’)  
will evaluate to the value of that input, $(‘some\_id’).setValue(123)  
sets the value.

Fred

–  
My ramblings: [http://www.spacevatican.org](http://www.spacevatican.org)
