Hi,
I am using the "select" HTML drop-down list. I wanted to know what the simplest way to have the page update with the newly selected list entry when refreshed.
Run this code below:
Code:
<body>
<form id="form1" name="form1" method="get" action="">
<label>Search Radius
<select name="select" size="1">
<option value="200">200 feet</option>
<option value="500">500 feet</option>
<option value="1000">1000 feet</option>
<option value="2000">2000 feet</option>
<option value="2640">1/2 a mile</option>
<option value="5280">1 mile</option>
</select>
</label>
<input type="submit" name="Submit" value="submitBut">
<%
if request.querystring("submit") <> "" then
response.Write(request.QueryString("select"))
end if
%>
</form>
</body>
</html>
you will see that the no matter which entry in the drop-down list the user selects, the list will always refresh to the first position in the list ("200 feet").
So what is the simplest way to get the currently selected entry to appear as the selected entry? Do I have to loop through each entry in the list, check to see if it is the selected entry and if so, set it as selected, if not skip?
Or is there some method of this object that simply selects the entry who's value equals (request.QueryString("select"))?? What would be the syntax for this?
Please respond with actual code rather than vague clues. Thank you.
|