• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

populate select box dynamically

 
drick brates
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
91
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
Author and ninkuma
Marshal
Pie
Posts: 65124
91
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.
 
Kiran Joshi
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic