View Full Version : JS in pop-up window adding a selection option to a drop down menu in the opener???

03-18-2004, 08:31 PM
Is it possible to have a popup window add a value to a drop down menu in the window opener? Here is my secenario:

Page 1: Has a drop down (select) list that is populated from a database query using ColdFusion. Below the drop down list are 3 buttons [add] [edit] [delete]. Regardless of the button choice, a popup window is spawned (Page 2).

Page 2: After either adding/editing/deleting the selected choice from page 1, I want to change the drop down menu on page one and then close Page 2. My problem is that I can't seem to change to options in the drop down menu.

I want to avoid submitting the form because of the validation in place on Page 1. So, if my drop down on Page 1 has 2 value:
[--- Make A Selection ---]
[TCole Design, 123 Main Street, Fairfax, VA 20150]

and I click on the [add] button below, after filling out a form in the popup window, I want the new value to be added to my DB (already done and working) and then I want the drop down menu to update to read like below. Then the popup window will close.
[--- Make A Selection ---]
[ABC Crating, 456 Main Street, Fairfax, VA 20150]
[TCole Design, 123 Main Street, Fairfax, VA 20150]

Is this possible???

03-19-2004, 01:19 AM
Well, I got it working ... sort of. I had to change my submit button to a button that calls a function to submit the form and then I simply have the popup window referesh the form after inserting the record into the database. I can't get the drop down on page one to select the proper value, but the information is now in the drop-down. This will have to do for now until someone can tell me how it should be done.

03-19-2004, 04:56 AM
Putting the function that adds the option item in the main window will fix the error. Then you will call that function in the popup like this: