SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Aug 22, 2006, 08:14 #1
- Join Date
- May 2002
- Location
- United States :)
- Posts
- 1,691
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Populating field from popup window
I have a form that has a drop down. In the drop down are items the person can select, then next to the drop down there is a link to add an item if the item is not listed in the drop down. That link is a popup window for the person to add a new item.
My question is, is there a way that after the person adds the item via the pop up the popup window closes and the drop down is now showing the new item they selected without losing all their form data they already entered?
Thanks
Silly
-
Aug 23, 2006, 05:14 #2
- Join Date
- Oct 2004
- Location
- Troy, Mi
- Posts
- 231
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
From the popup window, you can access the "window.opener" object to send the form data over to the main window.
So, for instance, if your dropdown had an id of "dropdown", you could do something like this in your popup:
var dropdown = window.opener.document.getElementById("dropdown");
dropdown[dropdown.length] = new Option(<fill in option values>);
Bookmarks