Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying drop down selections on same page 1

Status
Not open for further replies.
Jun 24, 2002
19
0
0
US
I need to build a table populated with items selected from a drop down list. A user would select "test 1" and click "add" button and the table would show "test 1". Then user can select "test 2" and click "add" and the table would show "test 1" and "test 2".

My real drop down box will have over one hundred options, and the users will not know to use the "ctrl" or "shift" keys to select many options from the list. They will want to select one and add then another and add, and another.

Here is what I have so far:
<html>
<head>
<title>add button test</title>
</head>
<body>
<form action=&quot;add.asp&quot; name=&quot;add_button&quot; id=&quot;add_button&quot; method=&quot;post&quot;>
<table width=&quot;600&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr><td width=&quot;50&quot;><select name=&quot;test_group&quot;>
<option>test 1</option>
<option>test 2</option>
<option>test 3</option>
<option>test 4</option>
</select></td>
<td width=&quot;5&quot;> </td>
<td width=&quot;50&quot;><input type=&quot;submit&quot; value=&quot;add&quot;></td>
<td>
<table width=&quot;495&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td><%Response.write (request.form(&quot;test_group&quot;))%></td>
</tr>
</table>

</td></tr>
</table>
</form>
</body>
</html>

Any help would be great thanks!


Bob C. I/T Department WYSAC
 
Assuming it is database driven...

Why not store the added item in a db with the session or user ID then every time the page is submitted (i.e. an item added) rebuild the page pulling the items from the db.

Then, you will end up with a list of added items in the db, ready to do whatever you need to.

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
This is db driven, this is part of a large input form, which I don't want to write to the db until everything is completed. This is one section of the form, and users will need a visual varification that they have selected all options needed. I need to be able to have the users select options from the drop down, see their selections on the same page, then once everything else is completed write the entire form input to a record set.

Bob C. I/T Department WYSAC
 
While I agree with Microbe/Steve, if you WANT to do it the other way .. assuming your are always appending to the same form element (test_group):

<html>
<head>
<title>add button test</title>
</head>
<body>
<form name=&quot;add_button&quot; id=&quot;add_button&quot; method=&quot;post&quot;>
<table width=&quot;600&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr><td width=&quot;50&quot;><select name=&quot;test_group&quot;>
<option>test 1</option>
<option>test 2</option>
<option>test 3</option>
<option>test 4</option>
<option>test 5</option>
<option>test 6</option>
<option>test 7</option>
<option>test 8</option>
</select></td>
<td width=&quot;5&quot;> </td>
<td width=&quot;50&quot;><input type=&quot;submit&quot; value=&quot;add&quot;></td>
<td>
<table width=&quot;495&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td><%Response.write (request.form(&quot;test_group&quot;))%></td>
</tr>
</table>
</td></tr>
</table>
<input type=&quot;hidden&quot; name=&quot;test_group&quot; value=&quot;<%=Request.Form(&quot;test_group&quot;)%>&quot; />
</form>
</body>
</html>

codestorm
Fire bad. Tree pretty. - Buffy
Kludges are like lies.
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Ok, Now I need the selections to be displayed in table rows, instead of one after another.

Now:
test1 test2 test3

would like:
test1
test2
test3



Bob C. I/T Department WYSAC
 
(untested)

<html>
<head>
<title>add button test</title>
</head>
<body>
<form name=&quot;add_button&quot; id=&quot;add_button&quot; method=&quot;post&quot;>
<table width=&quot;600&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr><td width=&quot;50&quot;><select name=&quot;test_group&quot;>
<option>test 1</option>
<option>test 2</option>
<option>test 3</option>
<option>test 4</option>
<option>test 5</option>
<option>test 6</option>
<option>test 7</option>
<option>test 8</option>
</select></td>
<td width=&quot;5&quot;> </td>
<td width=&quot;50&quot;><input type=&quot;submit&quot; value=&quot;add&quot;></td>
<td>
<table width=&quot;495&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<%dim arr_test_group,lng_count
arr_test_group = split(request.form(&quot;test_group&quot;),&quot;,&quot;)
for lng_count = 0 to ubound(arr_test_group)
%><tr>
<td><%=trim(arr_test_group(lng_count))
%></td>
</tr>
<%next
%></table>
</td></tr>
</table>
<input type=&quot;hidden&quot; name=&quot;test_group&quot; value=&quot;<%=Request.Form(&quot;test_group&quot;)%>&quot; />
</form>
</body>
</html>

codestorm
Fire bad. Tree pretty. - Buffy
Kludges are like lies.
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
codestorm,

Thanks again, that is great. Thank you for answering my coding question, and not telling me how to set up my code. You've been a big help.

Bob C. I/T Department WYSAC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top