Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

howto populate a select box using post data from a previous select box

howto populate a select box using post data from a previous select box

howto populate a select box using post data from a previous select box

Hi all. What I'm trying to do is get the contents of a select control from a previous pages form and then populate a new select control using all the options in the previous one (using jsp)

Its for a life insurance calculator. The user puts in details of all previous eplans  they have in place. There may be more than one plan so they have the option to keep adding plans. Once this is done, they proceed to a summary page which display everything including all the existing plans.

What I want to know is how can I access all the options in a particular select control to output them? I've already set all the options to selected in the previous form. Is this what I need to do or is there some other way?

If I'm going about this the wrong way, can you suggest an alternative? Many thanks.

RE: howto populate a select box using post data from a previous select box


<script lang="JavaScript">
var count = 0;
function mystore(inpname){
var str = "document.f1."+inpname;
obj = eval(str);
if (obj.selectedIndex!=0)
    if (count>0)
function showAll()
<form name="f1">
<input type="hidden" name="secret" value="">
<select name="sa">
<option value="">choice sa</option>
<option value="a001">plan a001</option>
<option value="a003">plan a003</option>
<input type="button" value="add to list" onClick="mystore('sa')">
<select name="sb">
<option value="">choice sb</option>
<option value="b002">plan b002</option>
<option value="b004">plan b004</option>
<input type="button" value="add to list" onClick="mystore('sb')">
<select name="sc">
<option value="">choice sc</option>
<option value="c001">plan c001</option>
<option value="c005">plan c005</option>
<input type="button" value="add to list" onClick="mystore('sc')">
<input type="button" value="submit form" onClick="showAll()">

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close