Drop-down lists

R

RColes

I have several long drop-down lists, i.e.;
<select size="1" name="UserArea" style="font-family: Book Antiqua;
font-size: 8pt">
<option selected></option>
<option>OD/OCD</option>
<option>ITSO</option>
<option>even more</option>
</select>

If there is an error on some of the fields I redisplay the page and all
fields except the selected box value are displayed.

<%
Select Case TransactionCode
Case "Submit"
Session("UserArea") = Request.form("UserArea")

If session("UserArea") = "" Then
ErrorMessage = "Please select area."
Else UserArea = session("UserArea")
ErrorMessage = session("UserArea")
End IF
...
%>

This prints out the last value selected, but UserArea remains in it's
initial state (nothing selected). I don't want them to have to reselect the
drop down they selected every time they change out the page.
RequestForm("UserArea") = session("UserArea") gives me an error.
How can I reset UserArea to the last value selected following a "Submit"?
 
S

Stefan B Rusynko

First of all the, 1st option is invalid
<option selected></option>
And you should declare a value for all options, even though it may be implied

Use
<select size="1" name="UserArea" style="font-family: Book Antiqua; font-size: 8pt">
<option value="OD/OCD" <%IF Session("UserArea")="OD/OCD" THEN%>selected<%END IF%>>OD/OCD</option>
<option value="ITSO" <%IF Session("UserArea")="ITSO" THEN%>selected<%END IF%>>ITSO</option>
<option value="even more" <%IF Session("UserArea")="even more" THEN%>selected<%END IF%>>even more</option>
</select>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


|I have several long drop-down lists, i.e.;
| <select size="1" name="UserArea" style="font-family: Book Antiqua;
| font-size: 8pt">
| <option selected></option>
| <option>OD/OCD</option>
| <option>ITSO</option>
| <option>even more</option>
| </select>
|
| If there is an error on some of the fields I redisplay the page and all
| fields except the selected box value are displayed.
|
| <%
| Select Case TransactionCode
| Case "Submit"
| Session("UserArea") = Request.form("UserArea")
|
| If session("UserArea") = "" Then
| ErrorMessage = "Please select area."
| Else UserArea = session("UserArea")
| ErrorMessage = session("UserArea")
| End IF
| ...
| %>
|
| This prints out the last value selected, but UserArea remains in it's
| initial state (nothing selected). I don't want them to have to reselect the
| drop down they selected every time they change out the page.
| RequestForm("UserArea") = session("UserArea") gives me an error.
| How can I reset UserArea to the last value selected following a "Submit"?
|
 

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