• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

dynamic drop down list values

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ramesh ,

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

Eric
 
today's feeble attempt to support the empire
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic