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
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts

    firing onChange select box from popup

    Is it possible to fire a onChange event on a parent page select box from a pop-up window? Currently I am looping through an array with form values and setting the select box value on the opener page. I tried to do an add focus but it didnt work.

    (this is in the pop-up window)

    for (i=0; i<myArray.length; i++) {
    window.opener.chgRow(myArray[i],"on");
    myfrmfld = "window.opener.document.frmPol.sltAgts" + myArray[i]
    eval(myfrmfld).focus();
    eval(myfrmfld).value = '<%=Request.Form("sltAgt")%>'
    }

    (on the parent page)

    <select name="slt2" onChange="foo()">

    On the parent page everytime one of these select boxes are changed it runs a onChange function. By setting these values from a pop-up window this onChange event is no fired. So I need to somehow fire the onChange when I change the value in my pop-up window.

    Does this make sense?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not sure what you mean, but if you want to perform a function in the parent window from the child window then preface the function name with "opener" like this: opener.function_name()

    The term "opener" refers to the window that opened the popup. Hope that helps.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Let me attempt to do a better job explaining. On my parent page I have rows of data that each have their own unique select box. On each of these select boxes there is an onChange event which calls a function. Everytime a select box is changed this function HAS to run. Now I have added a popup box which allows you to move multiple select boxes on the parent to a different value. The problem when doing this is that the select box is getting assigned its new value through js(pop-up) not by someone actually clicking on the select box and changing it. So my question is: from a pop-up window you are assigning new values to a select box on the parent page, this will change the value of the select box on the parent page but the browser does not constitute this as an onChange thus not firing its onChange function. So is there a way around this?


  •  

    Posting Permissions

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