aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes dynamic drop down list values 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 "dynamic drop down list values" Watch "dynamic drop down list values" New topic
Author

dynamic drop down list values

Ram Murthy
Ranch Hand

Joined: Aug 02, 2005
Posts: 91
In my jsp page i have two drop down list.
First drop down list has values X and Y.
Second drop down list values depends on the value of first drop down list.
If is select X in the first drop down list then second drop down list should have values 1 and 2.
If is select Y in the first drop down list then second drop down list should have values 3 and 4.
I need to do this validation in javascript that is when i click the second drop down list it should go to javascript and populate appropriate values in my second drop down list.

Can anyone please provide an approah to achieve this. Code samples will be most appreciated.

Thanks,
Ravi
[ December 29, 2005: Message edited by: Bear Bibeault ]

Cheers,
Ram
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61612
    
  67

This question gets asked at least once per week. Look through the history of this forum for previous discussions.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ram Murthy
Ranch Hand

Joined: Aug 02, 2005
Posts: 91
I checked using search page and also browsing the current list, couldn't find any one having the same question. So please if anyone can provide the solution or direct me to some links...

Thanks,
Ravi
Pratik Lohia
Ranch Hand

Joined: May 05, 2005
Posts: 88
In the first drop down, have your variables contain the key-id(apart from the ist drop-down data. You can use a pipe as a seperator) of the variables in the second drop down. Onchange event of the 1st drop down, call a function that would parse through your variables in the 1st frop down to obtain the id of variables in the 2nd drop-down and select those variables for yuor second drop down. Example Code ...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have three options for a double combo.

JavaScript Double COmbo, A traditional postback double combo, or an Ajax double combo. Do a search with any of those terms here or on Google and ou will find a lot of examples coded.

Eric
Ramesh Piyathilaka
Greenhorn

Joined: Oct 31, 2005
Posts: 7
Hi,

can some one help me how to create text boxs dynamically using servlets or jsp and capture those values in java script

Kind Regards
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Ramesh ,

You have a seperate post on this and do not try to steal other people's threads!

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamic drop down list values