Hi,
I'm using a code for opening a clild window from the parent window. The child window contains some <input type="file"> elements. After setting the values of these file elements I'm closing the child window. But before closing I want to set the values of file elements to the file elements on my parent window.
The code I'm using is as follows:
"parent.jsp"
=========
function createWindow() {
window.open("child.jsp");
return false;
}
<form method="post" action="display.jsp" enctype="multipart/form-data">
<input type="button" value="Add Attachments" onClick="return createWindow()"><br>
<input type="file" name="file1"><br>
<input type="file" name="file2"><br>
<input type="file" name="file3"><br>
<input type="submit" value="Submit Form"><br>
</center>
</form>
"child.jsp"
========
function returnToMainWindow() {
window.opener.document.forms[0].file1.value = document.forms[0].filex.value;
window.close();
}
<form method="post">
<center>
<input type="file" name="filex"><br>
<input type="file" name="filey"><br>
<input type="file" name="filez"><br>
<input type="button" onClick="returnToMainWindow()" value="Done">
</center>
</form>
The problem is when I'm setting the values of file control of child window to the file control of parent window using window.opener, it's unable to set up the values. Can someone rectify the problem in the code.