473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

client-side onclick populates dropdown

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

The function adds <optionelements 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="populateDropdown(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 ?

May 13 '07 #1
5 2017
Why don't you just return true in populateDropdown and call it as
onclick="return populateDropdown(this)"?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>I wrote a function to populate my dropdowns on the client-side.

The function adds <optionelements 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="populateDropdown(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 ?

May 14 '07 #2
What's the difference ?

"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Why don't you just return true in populateDropdown and call it as
onclick="return populateDropdown(this)"?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>>I wrote a function to populate my dropdowns on the client-side.

The function adds <optionelements 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="populateDropdown(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 ?


May 14 '07 #3
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='prePopulate(this)' ...

<script ...
function prePopulate(ddn){
if (ddn.options.length == 0)
// call your populate function:
populateDropdown(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" <RE**************************@mMvVpPsS.orgwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Why don't you just return true in populateDropdown and call it as
onclick="return populateDropdown(this)"?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>I wrote a function to populate my dropdowns on the client-side.

The function adds <optionelements 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="populateDropdown(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 ?


May 15 '07 #4
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" <Se*****************@discussions.microsoft.comwrot e
in message news:90**********************************@microsof t.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='prePopulate(this)' ...

<script ...
function prePopulate(ddn){
if (ddn.options.length == 0)
// call your populate function:
populateDropdown(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" <RE**************************@mMvVpPsS.orgwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Why don't you just return true in populateDropdown and call it as
onclick="return populateDropdown(this)"?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
I wrote a function to populate my dropdowns on the client-side.

The function adds <optionelements 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="populateDropdown(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 ?





May 17 '07 #5
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" <Se*****************@discussions.microsoft.comwrot e
in message news:90**********************************@microsof t.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='prePopulate(this)' ...

<script ...
function prePopulate(ddn){
if (ddn.options.length == 0)
// call your populate function:
populateDropdown(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" <RE**************************@mMvVpPsS.orgwrote in
message news:%2****************@TK2MSFTNGP05.phx.gbl...
Why don't you just return true in populateDropdown and call it as
onclick="return populateDropdown(this)"?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"John Grandy" <johnagrandy-at-gmail-dot-comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
I wrote a function to populate my dropdowns on the client-side.

The function adds <optionelements 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="populateDropdown(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 ?





May 17 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
2
by: Raquel | last post by:
How do I know whether the 'runtime client' and the 'application development client' are installed on my machine? When I issue the command "db2licm -l", it gives the following output: Product...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on Windows. I came across the following in the Info...
0
by: Harley | last post by:
Hello, I am just learning the tcp/ip functions etc under vb.net so please look over me if this is obviouse. I have been all over looking into any functions that I didn't totaly understand and...
8
by: Ankit Aneja | last post by:
i am doing here some some socket-client work in C# windows service it is working fine for multiple clients now i want to limit these multiple clients to 25 for example i want that when service...
2
by: Delmar | last post by:
I need to build Web Application that will generate a client to execute some operations. Each client has running silent application. Maybe somebody can advice me what can I do ? Thank you.
2
by: J Huntley Palmer | last post by:
I am having a horrific time integrating uw-imap's c-client for imap support in php. The problem is a whole bunch of "Text relocation remains referenced against symbol" errors during linking....
0
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <?php function...
2
by: nsaffary | last post by:
hi I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.