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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving ASP DropDown Value

Status
Not open for further replies.

ledsoft

Programmer
Sep 12, 2001
12
US
I have a dropdown called MyID that is populated from a MySQL database. This I thought would be the nerve racking part. But, it turns out I was able to find easy to follow samples. The problem is, after I populate the dropdown, how do I get the value that was selected by the end user?

Any ideas would be helpfull.

Thanks in advance
 
you should be able to request it?

how are you trying to get the value and where? _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
[sup] [/sup]
 
Sample of populating from ADO.

<select name=&quot;d1&quot; size=&quot;1&quot; onClick=&quot;ProcessID(d1)&quot; >

<% Do While Not ors.EOF %> <option value=&quot;<% = ors(&quot;planid&quot;) %>&quot;><% = ors(&quot;planid&quot;) %></option>
<% ors.movenext %>
<% loop %>
</select>

 
I'd get rid of the spaces in the = (write) if that isn't a copy/paste issue
eg:
&quot;<%=ors(&quot;planid&quot;) %>&quot;

there's no reason why
request.form(&quot;d1&quot;)

will not give you the value selected that I can see _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
[sup] [/sup]
 
See my FAQ regarding this: faq333-3228 _______________________________
regards,
Brian
AOL IM: FreelanceGaines
AG00280_.gif
 
I must be doing something wrong here. Can you assist please? As you can see, I tried a couple of different ways.

Thanks.

<script language=&quot;VBSCRIPT&quot;>
Function ProcessID(SelectedID)
request.form(&quot;d1&quot;)
response.write SelectedID
End Function
</script>

<select name=&quot;d1&quot; size=&quot;1&quot; afterupdate=&quot;ProcessID(d1)&quot; >

<% Do While Not ors.EOF %> <option value=&quot;<%=ors(&quot;planid&quot;) %>&quot;><%=ors(&quot;planid&quot;) %></option>
<% ors.movenext %>
<% loop %></select><br>
 
the big thing wrong here is the use of client side vbscript to get a server side object.

you need to convert that function to ASP and submit the form and then run the function _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
[sup] [/sup]
 
here's a quick eg:
<%
if request.form(&quot;d1&quot;)<>&quot;&quot; then
request.form(&quot;d1&quot;)
response.write SelectedID
else
%>
<form action=&quot;samepage.asp&quot; method=&quot;psot&quot;>
<select name=&quot;d1&quot; size=&quot;1&quot; afterupdate=&quot;ProcessID(d1)&quot; >

<% Do While Not ors.EOF %> <option value=&quot;<%=ors(&quot;planid&quot;) %>&quot;><%=ors(&quot;planid&quot;) %></option>
<% ors.movenext %>
<% loop %></select><br>
</form>
<% end if %>


that won't work quite right but I think it may clear it up a bit _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
onpnt2.gif
[sup] [/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top