Focusing child window as long as its open
I have a window in which I have a text field followed by a button . when I click on that it will open another window(a child window or so...). and he type some value in the child window and when it close the value enterd int the child window should display in the textbox in the parent window.
Also , The user should not be able to do anything on parent window as long as child window is open. If one wants to go to parent window , he should close the child window or click on the button in child window... and when close the focus should go to parent window.
Any idea of how to do this.. I am working on Ruby on rails.