This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Populating <select> with values from a database. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Populating <select> with values from a database." Watch "Populating <select> with values from a database." New topic
Author

Populating <select> with values from a database.

abhiavi kumar
Greenhorn

Joined: Mar 13, 2013
Posts: 20
Hello there,

I have a registration form, and I'm looking to populate a <select> with the values retrieved from the column of a database. How do I go about achieving this ? Here is an example for better detail.

The options of a <select> drop down list is populated from a certain column called "Manuid" which is located in a table called "Manu".

assuming the values under "Manuid" are "Sam" "Mike" "Arnie" and "Joe", I want all these names to appear when I click on the drop-down button. This is not a "fixed" column, meaning I will keep adding new names as well as deleting under "Manuid", which would mean a dynamic drop down list that changes every time I change the DB. How would I be able to do this? I'm only looking at Javascript and JDBC to achieve this... is it possible?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

You definitely need more than JavaScript and JDBC. In particular, you at least need Servlets (and more Java classes)

When you say it changes every time you change the database, do you mean on the existing already rendered page? If so, you need AJAX. Otherwise, you can just look up the values in that column when loading the registration forum.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Populating <select> with values from a database.
 
Similar Threads
retrieve data from database
Help with Send Email on submit
Help Needed: Search/Filter on a Datatable for displaying records.
accessing database using javascript
using database values to populate drop down menus