<select multiple="yes">
Hi,
I was wondering if the option of making mutiple choices is available on ASP (not ASP.NET). If yes, then how do I pass the values I ahve selected into the response file?
Thanks!
[194 byte] By [
erin] at [2007-11-18 19:12:36]

# 1 Re: <select multiple="yes">
Well, if you gave the select a name like this:
<select name="myselection" multiple="yes">
Then you might be able to access it like this:
Request.Form("myselection")
Sonu
# 2 Re: <select multiple="yes">
Thanks, but that code is possible only in PHP is it? What if I am on ASP?
erin at 2007-11-9 11:45:20 >

# 3 Re: <select multiple="yes">
That is the code for ASP!
Sonu
# 4 Re: <select multiple="yes">
But the problem is when I make a multiple selection, only the last selection I made is being carried over to the response file. Please look at my code. Could you tell me whats wrong?
File: addattr.asp
:
:
:<form action="add.asp" method="post" multiple="yes">
<CENTER>
<select name="fname" size="1">
<option value="Select Optional Attributes" name="fname" bgcolor="beige">Select Attribute</option>
<%while NOT rs.EOF%>
<CENTER><option><%=rs.fields("Attribute")%></option></p></CENTER>
<%rs.MoveNext
wend
rs.Close%>
</select>
<input type="submit" value="Submit">
</CENTER>
</form>:
:
:
:
________________________
In the response file, I extract the value like this:
<% dim fname
fname=request.form("fname")
response.write(fname)
%>
Thanks!
erin at 2007-11-9 11:47:23 >

# 5 Re: <select multiple="yes">
Your select statement should look like this:
<select name="fname" size="1" MULTIPLE>
And remove the Multiple from the form tag!
Sonu
# 6 Re: <select multiple="yes">
Got it, thanks!
But what do I do to individually refer to the different selections made? Right now all the values selected are referred to by the same fname tag in the response file, using:
<% dim fname
fname=request.form("fname")
response.write(fname)
%>
So suppose I chose 3 values A, B and C; response.write(fname) gives me the output A,B,C. What if I want to refer to just A, ot just B?
Thanks a lot!
erin at 2007-11-9 11:49:23 >

# 7 Re: <select multiple="yes">
If I remember correct it returns an array of Strings. So you could use something like:
response.write(fname[0])
sonu
# 8 Re: <select multiple="yes">
Got it. It involves using the split function.
Thanks a lot!
erin at 2007-11-9 11:51:32 >

# 9 Re: <select multiple="yes">
Ah...the split function! Didnt used ASP for a while. Good that you got the solution.
Sonu