Solved

get selected option

Posted on 1997-12-29
7
404 Views
Last Modified: 2009-12-16
I have a selection form on my page. When a user selects something by mouseclick, the list minimizes but doesn't loose focus. So I can't get the selected option before the user clicks somewhere else, because the onBlur-event doesn't occur and the selectedIndex isn't updated earlier.
Is there any way to get the selected option without the user has to click something else?
0
Comment
Question by:borsdorf
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:nanullnet
ID: 1277227
Yes, use the onChange handler.
0
 

Author Comment

by:borsdorf
ID: 1277228
Sorry, that's not the solution, because the Change-event doesn't occur before the object looses focus.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1277229
When the form is created you already know what the selected item is because you set this initially.  When the user changes the selection you use the onChange event to determine what the current selectedindex is.  The only way the selectedindex would change then is if the user clicks on one (or more) items of the selection list.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:borsdorf
ID: 1277230
May be, I didn't ask precisly enough. (Please excuse my bad english.) Normally, after selecting something from the selection list, the user has to click somewhere OUTSIDE of the select object (OK-button for example), because otherwise the select object doesn't loose its focus and the selectedIndex is not updated. What I want is that the user ONLY has to click the desired item and nothing else. Any idea?
0
 
LVL 1

Accepted Solution

by:
nanullnet earned 200 total points
ID: 1277231
Not true borsdorf.  You say that when "the list minimizes" you are refering to a multiple select.  When you click on any other item than the currently selected (or default) in that list, the onChange handler is tripped irregardless of whether the user ever moves his mouse again.  I use this in countless pages, so saying it doesn't work just does not cut it.  If you disagree, please post code and I will fix it.
0
 

Author Comment

by:borsdorf
ID: 1277232
Meanwhile I understood that I have a compatibility problem only. I tried my sample on different browsers and operating systems and found that the problem only happens on Navigator 2.x and 3.x under Windows 3.11. On other browser or OS the select object looses focus when the user selects something by mouseclick.

So my questions becomes harder: Is there any solution for Navigator 3 under Win 3.11?
0
 
LVL 1

Expert Comment

by:nanullnet
ID: 1277233
Unfortunately, if the Browser does not support it, there is little you can do to keep it the same.  The only workaround I know of is to have a button next to the select bar, that the user must click.  You can have that appear only for windows 3.1 users if you like, and let 32 bit users benefit from the ease of the onChange.  Code for detection is as follows:

if (navigator.appName == "Netscape Navigator" && parseFloat(navigator.appVersion) < 4 && navigator.appVersion.lastIndexOf('Win16') != -1) {
}
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question