This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

populate select box dynamically  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi...
like country and states having two select boxes
if i select country from first select box it will populate second select box from database using mysql;(jsp,javascript)
plz give me the fair code


waiting for the code...............


thanks®ards,
Santhosh
 
Sheriff
Posts: 67260
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"santhoshreq",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Bear Bibeault
Sheriff
Posts: 67260
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by santhoshreq:

waiting for the code



You will likely wait a long time. JavaRanch is not a code mill, it is a learning site. You are expected to do your own work and come here for help with it.

The specific question you asked is a very common one that you are likely to find many examples of with a little search effort on your part.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few things that I can tell you in this.

I assume you have two combo boxes first is State (province) & second is city. You want to show the cities in the selected state.

1) Get the initial values for the state,that you can get using some servlet.
2) Write one javascript function that will create HttpRequest using XMLHttpRequest() activex object , & pass your selected state as a request parameter to the the servlet.
3) This servlet should be able to fetch the cities using the request parameter,should prepare a recordset in the form of a XML file & send it to the client.
4) Your client should interpret this xml using DOM & create the cities on the fly.

how to do this every thing,this information is scattered in this group only.

hope ,this helps.
[ July 04, 2006: Message edited by: Kiran Joshi ]
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!