# Getting field value from child window \[Using Redbox\]

**URL:** <https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202>\
**Category:** Rails\
**Created:** [July 12, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202 "2007-07-12T12:03:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unnikrishnanes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ce73a5/32.png) [@unnikrishnanes](https://www.ruby-forum.com/u/unnikrishnanes)\
**Post date:** [July 12, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202/1 "2007-07-12T12:03:15Z")

</div>

I have a page in which I have a text field and next to that a button ,  
when I click on the button it should open window [using Redbox] so that  
I can type it in the window and when I give submit in the child window  
it shuold close the child window automatically and the inserted value  
should be added to the textbox in the parent window.

Please help

---

<div class="post-metadata">

**Author:** ![unnikrishnanes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ce73a5/32.png) [@unnikrishnanes](https://www.ruby-forum.com/u/unnikrishnanes)\
**Post date:** [July 12, 2007, 12:44pm UTC](https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202/2 "2007-07-12T12:44:55Z")

</div>

This is javascript question. Imagine your textbox have id ‘blabla’.

In your child window, your submit button must invoke this javascript  
question:  
top.opener.window.document.getElementById(‘blabla’).value =  
the\_new\_value;  
window.close();

On Jul 12, 5:03 pm, Unni K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![unnikrishnanes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ce73a5/32.png) [@unnikrishnanes](https://www.ruby-forum.com/u/unnikrishnanes)\
**Post date:** [July 12, 2007, 12:53pm UTC](https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202/3 "2007-07-12T12:53:10Z")

</div>

No, I want to use redbox, bcoz when entering data in the field of the  
child window, I dont want to allow users to enter datas in the parent  
window.

How to do that

---

<div class="post-metadata">

**Author:** ![unnikrishnanes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/ce73a5/32.png) [@unnikrishnanes](https://www.ruby-forum.com/u/unnikrishnanes)\
**Post date:** [July 12, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/getting-field-value-from-child-window-using-redbox/109202/4 "2007-07-12T16:28:25Z")

</div>

On Jul 12, 5:53 pm, Unni K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> No, I want to use redbox, bcoz when entering data in the field of the  
> child window, I dont want to allow users to enter datas in the parent  
> window.
> 
> How to do that

then you can just use  
window.document.getElementById(‘blabla’).value =  
the\_new\_value;

I don’t know the implementation of redbox. I assume redbox make “modal  
window” not using child window. So redbox page is same as in parent  
page.
