Returning values from popup form

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
stuartmarsh
Forum Newbie
Posts: 2
Joined: Fri Jul 29, 2005 9:23 am

Returning values from popup form

Post 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!! :)
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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>
stuartmarsh
Forum Newbie
Posts: 2
Joined: Fri Jul 29, 2005 9:23 am

Post 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
Post Reply