Assign variable name to drop down value & "change" refresh data

J

jimt

I have a drop down list containing a year (e.g 2005, 2004, 2003...) on an ASP
page and the value is one of (6 fields) that make up a key to a table in my
DB (the other key field values are already populated and the year field is
initially set to the first vaule in the drop down list). I would like to
assign a variable name to the <option...> value and automatically hide the
year value (the other key values controlled and hidden on a form on the page)
to refresh the data on the page base on the year.

Q1: How do you set the drop down value to a variable name?

Q2: Is there a way to automically (event, "on-mouse"?) refresh the page
(data on the page) if the user selects a different year value in the drop
down box (i.e. VBA terms "on-change")?

Thanks
Jim T
 
S

Stefan B Rusynko

Your form field values and option do not need to be the same
<select name="Year" size="1">
<option selected value="2006">year 1</option>
<option value="2005">year 2</option>
<option value="2004">year 3</option>
<option value="2003">year 4</option>
</select>

Or see http://www.asp101.com/samples/db_pulldown.asp
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|I have a drop down list containing a year (e.g 2005, 2004, 2003...) on an ASP
| page and the value is one of (6 fields) that make up a key to a table in my
| DB (the other key field values are already populated and the year field is
| initially set to the first vaule in the drop down list). I would like to
| assign a variable name to the <option...> value and automatically hide the
| year value (the other key values controlled and hidden on a form on the page)
| to refresh the data on the page base on the year.
|
| Q1: How do you set the drop down value to a variable name?
|
| Q2: Is there a way to automically (event, "on-mouse"?) refresh the page
| (data on the page) if the user selects a different year value in the drop
| down box (i.e. VBA terms "on-change")?
|
| Thanks
| Jim T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top