File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes drop down list boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "drop down list boxes" Watch "drop down list boxes" New topic

drop down list boxes

Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Funny how things seemed to work before I went on vacation, and now that I'm back, they don't....
Anyway, here's a little question I have.
I would like to have a drop down box and a submit button, where the value selected in the box gets sent to a servlet, etc, etc, etc, and I end up with the search results on the screen.
Here's my code:
<form method="POST" action="" target="right_frame">
See entire list of:<br>
<select name="tables" value="table">
<option value="envs">environments</option>
<option value="locations">locations</option>
<option value="platforms">platforms</option>
<option value="sft_fnds">software foundations</option>
<option value="owners">owners</option>
<input type="submit" value="Go">
Is the part between the <select> and </select> right? I need to send specific values to the servlet, and I'm not sure if you put it in the "value" part or not.
(not sure if this is clear or not, so let me know and I'll try explaining again!)
John Wetherbie

Joined: Apr 05, 2000
Posts: 1449
It looks right but I cheated. I viewed the page source for this topic and your HTML looks like the HTML used to "Hop to" another forum.

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Hummm... Well ok, I wonder what could be the problem then?
If I use radio buttons to display all the options that would be in the drop-down list, it works fine. But if I use the list, it's like it's not taking the proper value.
guess I'll keep trying!
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Ok, the list is working! I had the name and the value reversed. I wouldn't have guessed that, but I tried it and it worked. Now on to more complicated problems!
can you put a piece of code in your .jsp file that would connect to a database and populate a drop-down box for you? I would like to click on a link in one frame and have a new page display in another frame, but when this new page loads, I need to populate a drop-down list box with records from a table in my database. I have an idea how to do it by putting the code in a servlet, but that wouldn't run immediatly. I'm wondering if there's a way to put in directly in the page.
thanks a million!
I agree. Here's the link:
subject: drop down list boxes
It's not a secret anymore!