Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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???

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    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:

    opener.functionNameThatAddsAnOption(parameters);


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •