PDA

View Full Version : Setting parent attribute value from child window using javascript



javasr
04-13-2018, 12:47 AM
Hi All,

I have a complex requirement and unable to resolve it.

I have a parent window, that has the functionality to added a student name. Number of students that can be added is dynamic, that means there could be 1 or more input fields. For every field when the user enters 3 characters a child window pops up with a list of names and a radio button to select the name.

In the child window, when the user selects a radio button and submits/saves, I want to populate the parent window with the name selected in the child window and close the child window.

The tricky part is how to identify the parent input variable that called the child window.

Any help is appreciated.

Thank You.

jscheuer1
04-13-2018, 06:04 AM
If it's a true child window opened by the parent, then from within the child window, the parent window is:


opener

So you can do things like - say there's a var on the parent named bob. From the child, that's:


opener.bob

Or, if you want to walk the document tree of the parent from the child:


opener.document.body

will get you started.

If you want more help, be much more specific and if possible post a link to the parent page and describe what actions, in detail, are to be done, and what the desired result is.