GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Help ...Dynamic Drop Down list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help ...Dynamic Drop Down list" Watch "Help ...Dynamic Drop Down list" New topic
Author

Help ...Dynamic Drop Down list

himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
Please suggest me some solution for my problem,
I have created one web application using HTML and JavaScript in which I have one drop down list. The initial values in this drop down list is populated from database through function using JSP when first time page loads. In addition, my HTML page is having alphabet list from A….Z. Clicking on any alphabet should display only those values in this drop down list, whose first latter starts with clicked alphabet. For example, If I click on alphabet “B” than, I want show only those values in drop down list, whose first latter starts with “B” and so on. I am doing this through JavaScript. Now the problem is that first time it works fine. But next time when I click on any other alphabet, It does not. Reason being, now drop down list contains only those values, which are result of previous alphabet click action. I must need original drop down list throughout. To get rid of this, I need to store initial values somewhere. But I do not know how?
Could any one suggest any idea how could I tackle this problem?
Thanks in advance.


If you want to become a rich, do not work for others but make others to work for you.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are going to have to do it with an array and get the letters of the alphabet from that array and then populate it. Look at http://www.dynamicdrive.com to show you how to populate a select from an array with their combo boxes.

Eric
himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
Thanks a lot Eric ,
You have solved my problem
Hemant
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Glad to help
 
GeeCON Prague 2014
 
subject: Help ...Dynamic Drop Down list