Click to See Complete Forum and Search --> : <option>'s


ldoodle
02-09-2007, 07:40 AM
Hi,

I have a list of options (7 though 11) on a form which posts back to itself with updated db info based on the year selected.

One thing I would like to do, it have the year pre-selected based on the year they just chose. Obviously if they only just arrived at the page, it defaults to the 'Select Year' option. I know how to do this if the years were in the db, but they're static html, and can't quite get the coding right!

Thanks/...

<option value="">Select Year</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>

gil davis
02-09-2007, 08:21 AM
<%
function chkSlct(it, val)
if request.form(it) = val then
chkSlct = " selected"
else
chkSlct = ""
end function %>
...
<select name="selectName" ... >
<option value="7"<%=chkSlct("selectName", "7")%>>7</option>
...