aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes populate select box dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "populate select box dynamically" Watch "populate select box dynamically" New topic
Author

populate select box dynamically

drick brates
Greenhorn

Joined: Jul 01, 2006
Posts: 1
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

Joined: Jan 10, 2002
Posts: 60077
    
  65

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60077
    
  65

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

Joined: Sep 04, 2005
Posts: 54
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: populate select box dynamically
 
Similar Threads
Dynamic selection problem
populating jsp fields from java object
Drop down from DataBase problem
iterate doubt
Struts2 mapping query