I'm writing a form that will include a place to upload a pdf. I would like the upload section to be a separate form in a popup. After the user successfully uploads a file I want the original form/window to update with a link to the uploaded file and a button to change the file (upload a new file).

I'm basically stuck on the communication between the windows. I was attempting to run a javascript function on the body load of the form action script that would modify the html of the original window. Is this possible or is there some other method that would work better?

Thanks,
David

I figured it out!
For anyone else interested:

opener.document.getElementById('htmlID').innerHTML="Blah Blah"

This will modify the window that opened a popup

Hey i was trying to do exactly the same thing..
i google on this thread...can you brief me on how to go about it.
Thanks

Regards,
ZeAh

Just as you can use

document.getElementById('htmlID')

to manipulate html objects on your page you can use

opener.document.getElementById('htmlID')

to manipulate the objects in the window from which a popup was opened.

Likewise, when you open a popup you can give the window object a reference variable like so:

popupWindow = window.open('url','windowName','options')

You can then manipulate html objects on that page via

popupWindow.document.getElementById('htmlID')

Is this enough info? Or were you looking for more specific instruction on the whole process?

thanks for the post..
i created the a popup uploader form and added uploading functionality to it..
but i was not able to perform the last step on the url
http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

where i have to get result back on the iframe...and one more thing..how do i automatically close the popup window when the uploading is completed..
thanks

Regards,
ZeAh

Sorry but I'm not quite sure about the tutorial. I'm not that good with javascript.

As far automatically closing I would think that at the end of your code you could put in:

<script language="javascript">
window.onload = window.close();
</script>

You would just have to make sure it's after all the other code.

Thanks Nizuya..tweaking a little on the code worked..made a pop up that uploads the file and closes..still have to work on the replacing or deleting the file option..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.