This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Adding Values on runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Adding Values on runtime" Watch "Adding Values on runtime" New topic
Author

Adding Values on runtime

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 513
Hi all i have following view of my jsp page
|------------------| |------------------|
|combo Box 1 V| |combo Box 2 V |
|------------------| |------------------|
For populating both comoboxes i have two querys
i m filling combox1 when i load my page
but combox2 is to be filled after value selection
from one cause that valueis used in query for next combobox!! this is to be done with out refreshing the form , i cant use jsp code for it!
so is there any way to do it using javascript ???
I know i will have to get values for all id in combox1 which r to be filled on cb2 but i m not getting how to do this onchage event !!
kindly help me out
thanx in advance !!!


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1028
Hi Praful,
if the order ( index ) of selectbox-options is equal, you can use selectedIndex:

hth
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15003
Yeah, you can do it with JavaScript, it is called a double combo
Here is a list of scripts that may help
http://www.javascriptkit.com/script/cutindex16.shtml
Eric
 
 
subject: Adding Values on runtime
 
Threads others viewed
Need Big Time Help
Value of control not preserved
Struts combo box
MySQL query to fill HTML combo box?
combo boxes and iterator
IntelliJ Java IDE