Page 1 of 1

Returning values from popup form

Posted: Fri Jul 29, 2005 9:33 am
by stuartmarsh
Does anybody know how I can pass form values from a popup window back to its parent?
I want a button on a webpage to open a small popup window where a user can select from a list of values. When the user clicks OK, I need the form to close and the values to have been passed back to the parent, preferably without refreshing the parent page.
I believe this can be done with Javascript using something like document.form or similair but I am a newbie at Javascript.

Please help!! :)

Posted: Fri Jul 29, 2005 10:18 am
by Burrito

Code: Select all

<input type=&quote;text&quote; name=&quote;whatever&quote;>
<input type=&quote;button&quote; value=&quote;update parent&quote; onClick=&quote;opener.document.MyForm.whatever.value = document.getElementsByName('whatever').value&quote;>

Code: Select all

<form name=&quote;MyForm&quote;>
<input type=&quote;text&quote; name=&quote;whatever&quote;>
</form>

Posted: Sat Jul 30, 2005 7:33 am
by stuartmarsh
Thanks I think thats what Im looking for.
Now I just need to put it into a function and Im done.
Thanks for the help. :D