Use Drop-Downs as Search Criteria, retain the value after the page refresh 
Author Message
 Use Drop-Downs as Search Criteria, retain the value after the page refresh

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?



Tue, 10 Dec 2002 03:00:00 GMT  
 Use Drop-Downs as Search Criteria, retain the value after the page refresh
Write out all the SELECT elements as normal with the one that was used in
the query as

-H>
...
<option value="myval" selected="true">Hello</option>
...
<H-

--
Dominic



Tue, 10 Dec 2002 03:00:00 GMT  
 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?



Tue, 10 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. retain Template dropdown list value

2. Data bound drops downs dont drop down!

3. Recursively search for files using a criteria.

4. Drop downs

5. Problems using CommandBarComboBox as search criteria for FindRecord method

6. using multiple search criteria to find a record

7. using multiple search criterion to find a record

8. Problems using search criteria with CR8 web component in ASP

9. Search Criteria using InputBox

10. How come my code drop downs are incomplete

11. Drop downs don't work on other computers

12. Drop Downs Don't work on other computers

 

 
Powered by phpBB® Forum Software