client-side onclick populates dropdown

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Grandy

    client-side onclick populates dropdown

    I wrote a function to populate my dropdowns on the client-side.

    The function adds <optionelemen ts to the <selectonly if none are
    initially present.

    I call the population function from either the onfocus or onclick event of
    the <selectas follows :

    onclick="popula teDropdown(this );return true;"

    It works in Firefox.

    In IE, the dropdown is populated but the default handler for the click event
    is not invoked, thus requiring the user to click the dropdown twice : once
    to populate it and once to drop it down.

    Does anyone know what is going on and a workaround for what appears to be an
    IE bug ?



  • Eliyahu Goldin

    #2
    Re: client-side onclick populates dropdown

    Why don't you just return true in populateDropdow n and call it as
    onclick="return populateDropdow n(this)"?

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]




    "John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
    news:%23fVNzOZl HHA.596@TK2MSFT NGP06.phx.gbl.. .
    >I wrote a function to populate my dropdowns on the client-side.
    >
    The function adds <optionelemen ts to the <selectonly if none are
    initially present.
    >
    I call the population function from either the onfocus or onclick event of
    the <selectas follows :
    >
    onclick="popula teDropdown(this );return true;"
    >
    It works in Firefox.
    >
    In IE, the dropdown is populated but the default handler for the click
    event is not invoked, thus requiring the user to click the dropdown twice
    : once to populate it and once to drop it down.
    >
    Does anyone know what is going on and a workaround for what appears to be
    an IE bug ?
    >
    >
    >

    Comment

    • John A Grandy

      #3
      Re: client-side onclick populates dropdown

      What's the difference ?

      "Eliyahu Goldin" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
      message news:%23y59Ygfl HHA.4592@TK2MSF TNGP05.phx.gbl. ..
      Why don't you just return true in populateDropdow n and call it as
      onclick="return populateDropdow n(this)"?
      >
      --
      Eliyahu Goldin,
      Software Developer & Consultant
      Microsoft MVP [ASP.NET]


      >
      >
      "John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
      news:%23fVNzOZl HHA.596@TK2MSFT NGP06.phx.gbl.. .
      >>I wrote a function to populate my dropdowns on the client-side.
      >>
      >The function adds <optionelemen ts to the <selectonly if none are
      >initially present.
      >>
      >I call the population function from either the onfocus or onclick event
      >of the <selectas follows :
      >>
      >onclick="popul ateDropdown(thi s);return true;"
      >>
      >It works in Firefox.
      >>
      >In IE, the dropdown is populated but the default handler for the click
      >event is not invoked, thus requiring the user to click the dropdown twice
      >: once to populate it and once to drop it down.
      >>
      >Does anyone know what is going on and a workaround for what appears to be
      >an IE bug ?
      >>
      >>
      >>
      >
      >

      Comment

      • =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=

        #4
        Re: client-side onclick populates dropdown

        John,

        I would pre-populate the dropdowns before User clicks on them, say when the
        page is loaded, but if you need to wait until User decides to use your
        control, you can try to work around the IE issue by placing the following (or
        similar) code in onmousemove event:
        <select onmousemove='pr ePopulate(this) ' ...

        <script ...
        function prePopulate(ddn ){
        if (ddn.options.le ngth == 0)
        // call your populate function:
        populateDropdow n(ddn);
        }

        it seems to be working fine for smaller lists (up to a few hundred items)

        HTH

        "John A Grandy" wrote:
        What's the difference ?
        >
        "Eliyahu Goldin" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
        message news:%23y59Ygfl HHA.4592@TK2MSF TNGP05.phx.gbl. ..
        Why don't you just return true in populateDropdow n and call it as
        onclick="return populateDropdow n(this)"?

        --
        Eliyahu Goldin,
        Software Developer & Consultant
        Microsoft MVP [ASP.NET]




        "John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
        news:%23fVNzOZl HHA.596@TK2MSFT NGP06.phx.gbl.. .
        >I wrote a function to populate my dropdowns on the client-side.
        >
        The function adds <optionelemen ts to the <selectonly if none are
        initially present.
        >
        I call the population function from either the onfocus or onclick event
        of the <selectas follows :
        >
        onclick="popula teDropdown(this );return true;"
        >
        It works in Firefox.
        >
        In IE, the dropdown is populated but the default handler for the click
        event is not invoked, thus requiring the user to click the dropdown twice
        : once to populate it and once to drop it down.
        >
        Does anyone know what is going on and a workaround for what appears to be
        an IE bug ?
        >
        >
        >
        >
        >
        >

        Comment

        • John A Grandy

          #5
          Re: client-side onclick populates dropdown

          Hi Sergey and thanks for the response.

          I have been using onmousedown , which works for IE7 and Firefox, but not
          IE6.

          Which browsers have you tested onmousemove with ?


          "Sergey Poberezovskiy" <SergeyPoberezo vskiy@discussio ns.microsoft.co mwrote
          in message news:9000AEAD-A110-421F-8A32-734224600894@mi crosoft.com...
          John,
          >
          I would pre-populate the dropdowns before User clicks on them, say when
          the
          page is loaded, but if you need to wait until User decides to use your
          control, you can try to work around the IE issue by placing the following
          (or
          similar) code in onmousemove event:
          <select onmousemove='pr ePopulate(this) ' ...
          >
          <script ...
          function prePopulate(ddn ){
          if (ddn.options.le ngth == 0)
          // call your populate function:
          populateDropdow n(ddn);
          }
          >
          it seems to be working fine for smaller lists (up to a few hundred items)
          >
          HTH
          >
          "John A Grandy" wrote:
          >
          >What's the difference ?
          >>
          >"Eliyahu Goldin" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
          >message news:%23y59Ygfl HHA.4592@TK2MSF TNGP05.phx.gbl. ..
          Why don't you just return true in populateDropdow n and call it as
          onclick="return populateDropdow n(this)"?
          >
          --
          Eliyahu Goldin,
          Software Developer & Consultant
          Microsoft MVP [ASP.NET]


          >
          >
          "John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
          news:%23fVNzOZl HHA.596@TK2MSFT NGP06.phx.gbl.. .
          >>I wrote a function to populate my dropdowns on the client-side.
          >>
          >The function adds <optionelemen ts to the <selectonly if none are
          >initially present.
          >>
          >I call the population function from either the onfocus or onclick
          >event
          >of the <selectas follows :
          >>
          >onclick="popul ateDropdown(thi s);return true;"
          >>
          >It works in Firefox.
          >>
          >In IE, the dropdown is populated but the default handler for the click
          >event is not invoked, thus requiring the user to click the dropdown
          >twice
          >: once to populate it and once to drop it down.
          >>
          >Does anyone know what is going on and a workaround for what appears to
          >be
          >an IE bug ?
          >>
          >>
          >>
          >
          >
          >>
          >>
          >>

          Comment

          • =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=

            #6
            Re: client-side onclick populates dropdown

            John,

            I was testing on IE6 - and on it onmousedown works the same as onclick -
            that is why I used onmousemove - then it seems to work just fine.

            "John A Grandy" wrote:
            Hi Sergey and thanks for the response.
            >
            I have been using onmousedown , which works for IE7 and Firefox, but not
            IE6.
            >
            Which browsers have you tested onmousemove with ?
            >
            >
            "Sergey Poberezovskiy" <SergeyPoberezo vskiy@discussio ns.microsoft.co mwrote
            in message news:9000AEAD-A110-421F-8A32-734224600894@mi crosoft.com...
            John,

            I would pre-populate the dropdowns before User clicks on them, say when
            the
            page is loaded, but if you need to wait until User decides to use your
            control, you can try to work around the IE issue by placing the following
            (or
            similar) code in onmousemove event:
            <select onmousemove='pr ePopulate(this) ' ...

            <script ...
            function prePopulate(ddn ){
            if (ddn.options.le ngth == 0)
            // call your populate function:
            populateDropdow n(ddn);
            }

            it seems to be working fine for smaller lists (up to a few hundred items)

            HTH

            "John A Grandy" wrote:
            What's the difference ?
            >
            "Eliyahu Goldin" <REMOVEALLCAPIT ALSeEgGoldDinN@ mMvVpPsS.orgwro te in
            message news:%23y59Ygfl HHA.4592@TK2MSF TNGP05.phx.gbl. ..
            Why don't you just return true in populateDropdow n and call it as
            onclick="return populateDropdow n(this)"?

            --
            Eliyahu Goldin,
            Software Developer & Consultant
            Microsoft MVP [ASP.NET]




            "John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
            news:%23fVNzOZl HHA.596@TK2MSFT NGP06.phx.gbl.. .
            >I wrote a function to populate my dropdowns on the client-side.
            >
            The function adds <optionelemen ts to the <selectonly if none are
            initially present.
            >
            I call the population function from either the onfocus or onclick
            event
            of the <selectas follows :
            >
            onclick="popula teDropdown(this );return true;"
            >
            It works in Firefox.
            >
            In IE, the dropdown is populated but the default handler for the click
            event is not invoked, thus requiring the user to click the dropdown
            twice
            : once to populate it and once to drop it down.
            >
            Does anyone know what is going on and a workaround for what appears to
            be
            an IE bug ?
            >
            >
            >


            >
            >
            >
            >
            >
            >

            Comment

            Working...