View Full Version : firing onChange select box from popup

01-15-2003, 08:06 PM
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++) {
myfrmfld = "window.opener.document.frmPol.sltAgts" + myArray[i]
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?

01-15-2003, 08:57 PM
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.

01-15-2003, 09:06 PM
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?