• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic drop down list values

 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question gets asked at least once per week. Look through the history of this forum for previous discussions.
 
Ram Murthy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramesh ,

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

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic