
Use Drop-Downs as Search Criteria, retain the value after the page refresh
One way: pass the value of the drop down back to a function which selects the
matching option and call the function when the page loads.
<%
Dim daValue
daValue = Request.Form("daChoice")
%>
<head>
<script>
function setSelect() {
with (document.daForm) {
for (var i=0; i<daChoice.length; i++) {
if (daChoice[i].value == '<%= daValue %>') {
daChoice[i].selected = true;
break;
}
}
}
}
</script>
<body onload="setSelect();">
<form name="daForm" method="post">
<select name="daChoice">
<option value="alpha">1st Choice
<option value="beta" >2nd Choice
<option value="gamma">3rd Choice
</select>
<input type="text" value="<%= daValue %>" readonly><br>
<input type="submit">
</form>
<body>
=-=-=
Steve
-=-=-
Quote:
> I have a page with a drop down box which I want to use to select data to
> display. Below the box is the results of the query.
> So the results are displayed on the same page as the dropdown.
> When I select an item in the drop down and click on Submit, it does the
> query okay but the drop-down value reverts back to its original value.
> How can I retain the value that I put in there when the page refreshes?