开发者

Passing value from Child to Parent and setting the values in Parent Form to save Child details

开发者 https://www.devze.com 2023-03-28 11:20 出处:网络
I have a Child javascript popup window jsp which generates dynamic table of values. I want these table values to be passed to the Parent window 开发者_运维百科jsp and from there on click of Submit the

I have a Child javascript popup window jsp which generates dynamic table of values. I want these table values to be passed to the Parent window 开发者_运维百科jsp and from there on click of Submit the child details to be stored in DB.

The Form which is used by the parent needs to handle these list of table contents coming from Child and do the saving process

Regards Ron


Use window.opener object to communicate to the parent. Either directly interact with the parent elements

window.opener.document.getElementById()

or call a parent function and pass the data to be submitted as arguement

window.opener.parent_func(dataToSubmit)

You can set the values of your form and submit it in this function. If the data is individual field values of the child window then you can use the variable used while opening of the child window to get the child window's elements from parent as follows

var childObj=window.open(options);

use childObj to get child window's data now as childObj.document.getElementById()

0

精彩评论

暂无评论...
验证码 换一张
取 消