Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drop Downs

 
Chinni Bujji
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have 2 drop down in the jsp page.
The first drop down is dynamically populated

The second drop down will be populated depending on the selection in the first one.

The second drop down title should be Select XXX Type where XXX is the value selected in the first drop down
I am having the id of the first selected drop down and i am sending the id to the Action Class

How would i get the value of that particular id ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This one of our most asked question.
Search this, and the HTML forum (Google too) with keywords:
"Dependent dropdown" or "cascading dropdown" and you will find plenty of discussion on the subject.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Did you find any code related to it. If so, could you please pass the url/ code which would be helpful.
regards
sudha
 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this help or you are looking for a struts specific solution ?
Remove - from ev-al
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the uncessessary use of eval()?

Also this example does not account for the fact that the values in the secondary dropdown depend upon the selected value.
[ October 12, 2007: Message edited by: Bear Bibeault ]
 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True eval is unnecessary ..
Here is a better example

 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Edit: thread hijack removed]
[ October 16, 2007: Message edited by: Bear Bibeault ]
 
Gayathri Chowduru
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
So, your first drop down is being populated by a server call. right. In the Select tag, give the javascript function, like
<Select name="firstDropDown" onChange="displaySecondDropDownList()">
<option ..></option>
in the javascript function,
function displaySeconDropDownList(){
var selectedValue = document.forms[0].firstDropDown.options[selectedIndex].value
then take a hidden variable and assign this value to that variable and set in the corresponding form.
Then invoke the action class, and get the corresponding second dropdown list values from the database based on this selected value. :-)
 
shah rhukh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi....

i had face the same problem recently........
For this AJAX is the best solution..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic