Select object events problem in classic asp

Discussion in 'Javascript' started by fig000, Apr 8, 2004.

  1. fig000

    fig000 Guest

    Hi,

    I want to use a select object in asp and have the user pick
    something from this select and have javascript open a window fired by
    an event. Once the new window is open it displays another select with
    data based on what was picked in the first window. Once a choice is
    made in the second window, it allow users to click a submit button and
    pass back the chosen value to the calling window.


    Let's say the first window has a select with two choices:

    Red
    Blue

    Let's assume the user picks blue and the second window is opened.

    Now, I tried using the onchange and the onclick events to open the
    new window. Here are the results.


    1.By putting the open window code in onchange event the second
    window opens fine . Unfortunately it's possible that the user could
    close the second window accidentally without hitting the submit button
    and nothing would be passed back to the calling window. This would
    require hitting "blue" again to reopen the window. However the
    onchange event doesn't fire unless a new value is picked; clicking
    "blue" does nothing. So I abandoned that.


    I then tried onclick. This works fine in that it will always fire
    once the user clicks on a choice in the select object. However it has
    behavior that would drive my users crazy.

    Usually, with a select object, you can click once which exposes
    the dropdown list and leaves it exposed, even if you release the left
    mouse button.
    It just sits there and gives you the chance to leisurely choose what
    you want.
    In this case, when I used the onclick event to open the second
    window, it exposed the dropdown list, but the second I let go of the
    left mouse button the event was fired, my javascript took over and the
    second window was opened and the first window (where the list was) was
    obscured.

    It does work if you don't let go of the left mouse button and move
    immediately to your choice, but I think this will drive my users
    crazy. I would like the select to function as it normally does but
    also to have it fire my javascript each time a choice is made in the
    select in the first window. Any ideas?

    Neil
    fig000, Apr 8, 2004
    #1
    1. Advertising

  2. On 7 Apr 2004 20:34:24 -0700, fig000 <> wrote:

    [snip]

    > Let's say the first window has a select with two choices:
    >
    > Red
    > Blue
    >
    > Let's assume the user picks blue and the second window is opened.
    >
    > Now, I tried using the onchange and the onclick events to open the
    > new window. Here are the results.
    >
    > 1.By putting the open window code in onchange event the second
    > window opens fine. [...]


    You should never perform an action (such as opening a window, following a
    link, etc) based on the onchange event.

    Use a separate button.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Apr 8, 2004
    #2
    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. Guest
    Replies:
    2
    Views:
    554
    Walter Wang [MSFT]
    Jul 17, 2006
  2. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    334
    Chris
    Aug 30, 2005
  3. David A. Beck
    Replies:
    10
    Views:
    985
    Scott McNair
    Apr 13, 2004
  4. Jai Singh
    Replies:
    6
    Views:
    1,044
    Evertjan.
    Jun 18, 2009
  5. palmiere
    Replies:
    1
    Views:
    377
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page