This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic drop down list from an array Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Dynamic drop down list from an array" Watch "Dynamic drop down list from an array" New topic
Author

Dynamic drop down list from an array

Ramesh Sunkara
Ranch Hand

Joined: Mar 01, 2010
Posts: 78
Hi,

My actaul scenario is to read some values from a notepad file and display them in the dropdown list. [ Am working in jsp]

I am able to get the values and store it in array but am not able to populate in the drop down list dynamically.

Here am pasting the sample code. The values which i stored in the array are not beling populated in dropdown list.

NOTE: I cant use any onchange functions or onclick functions.



Thanks for your help,
Ramesh.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
You code is running before the element is on the page. Your error message in the JavaScript console should tell you that in a cryptic way. Either run it via window.onload or put the code after the element on the page.

Eric
Ramesh Sunkara
Ranch Hand

Joined: Mar 01, 2010
Posts: 78
Thanks ERIC

It solved my problem
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Dynamic drop down list from an array
 
Similar Threads
Drop Down List do not create when more elements added
JSP variable typical problem
Problem with mozilla firefox browser while creating dynamic dropdown list
putting values from ArrayList to optionlist/dropdownlist
separate data with comma separated values and store them in a array