Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

window.opener problem in javascript

807597Jan 28 2005 — edited Feb 10 2005
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2005
Added on Jan 28 2005
9 comments
680 views