• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

populate select box dynamically

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 67746
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
"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: 67746
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

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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic