Firing an event in a parent window ?

Discussion in 'Javascript' started by Adrian Parker, Aug 21, 2006.

  1. 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 ?
    --
    Adrian
    Adrian Parker, Aug 21, 2006
    #1
    1. Advertising

  2. Adrian Parker

    Guest

    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
    , Aug 21, 2006
    #2
    1. Advertising

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

    <> wrote in message
    news:...
    | 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
    |
    Adrian Parker, Aug 21, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob
    Replies:
    4
    Views:
    1,165
    Vidar Petursson
    Jun 5, 2004
  2. Earl Teigrob
    Replies:
    1
    Views:
    5,815
    Earl Teigrob
    Jun 16, 2004
  3. Andy
    Replies:
    1
    Views:
    801
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Sep 29, 2005
  4. cindy
    Replies:
    0
    Views:
    401
    cindy
    Sep 9, 2008
  5. Replies:
    1
    Views:
    1,665
    Evan Freeman
    Sep 12, 2008
Loading...

Share This Page