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

capture drop down value

Status
Not open for further replies.

warren2600

Programmer
Jun 28, 2004
13
0
0
US
I tried to search for this but couldn't find it.
Anyway, i'm new to asp and trying to pass the 'value' of a drop down box.
here's my question:
how do you capture the value of the drop down box?
do i have to use a submit button?

thanks,
warren
 
page1.asp: form with a drop down and submit button

<form method="POST" action="page2.asp">
<select size="1" name="mydropdown">
<option>choice1</option>
<option>choice2</option>
<option>choice3</option>
</select>
<input type="submit" value="Submit" name="B1">
</form>

page2.asp capture the selected value from drop down

dropdownval=Request.Form("mydropdown")

-L
 
so the only way to capture the value is with a submit button?
 
sure...sorry.
i'm just used to object.value
just wanted confirmation that i always have to use submit if i want to capture values of objects in asp since it's server side scripting.
thanks,
warren
 
If you want the server to have the value of the menu, then yes, it has to be submitted to the server in a form. Nothing the user does is ever sent to the server unless he clicks on a link or submits a form, OR Javascript built into the page mimics clicking a link or submitting a form. Simple as that.

If you want the client -- the browser -- to do something with the value, then no, it doesn't need to be submitted. You'd use Javascript to do something on the OnChange event, most likely: see the Javascript forum, forum216.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top