Firing an event in a parent window ?

A

Adrian Parker

I have a popup window that displays a calendar; it's opened by a button that
relates to a textbox used to enter a date. When the popup is opened, the ID
and the value of the date textbox is passed as an argument. I can update
the date control with the newly selected date, but how then can I trigger a
changed event on the date textbox control from the child calendar window ?
 
O

ozfred

Adrian said:
I have a popup window that displays a calendar; it's opened by a button that
relates to a textbox used to enter a date. When the popup is opened, the ID
and the value of the date textbox is passed as an argument. I can update
the date control with the newly selected date, but how then can I trigger a
changed event on the date textbox control from the child calendar window ?

If you are changing the text input's value, you must have a reference
to it. If you want to call its onchange handler, then do it. You are
probablly doing something like:

var inputRef = opener.document.getElementById( someID );
inputRef.value = someNewValue;

// Now call onchange
if ('function' == typeof inputRef.onchange) inputRef.onchange();
 
A

Adrian Parker

Thanks. Had to use inputRef.fireEvent('onchange') to get it to work in the
end though.

| Adrian Parker wrote:
| > I have a popup window that displays a calendar; it's opened by a button
that
| > relates to a textbox used to enter a date. When the popup is opened,
the ID
| > and the value of the date textbox is passed as an argument. I can
update
| > the date control with the newly selected date, but how then can I
trigger a
| > changed event on the date textbox control from the child calendar window
?
|
| If you are changing the text input's value, you must have a reference
| to it. If you want to call its onchange handler, then do it. You are
| probablly doing something like:
|
| var inputRef = opener.document.getElementById( someID );
| inputRef.value = someNewValue;
|
| // Now call onchange
| if ('function' == typeof inputRef.onchange) inputRef.onchange();
|
|
| --
| Fred
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top