[thelist] ASP Select Form not auto-selecting

Rob Smith rob.smith at THERMON.com
Thu Sep 25 16:06:21 CDT 2003


Hi list

If you've ever created a form that submits to itself for form validation
before proceeding on, this is for you. Mine has a drop-down menu that, if
there's something wrong with the form, would auto select whatever WAS
originally selected:

<select name="Manager">
 <option value=""></option>
 <%
 while not Managers.eof
  response.write("<option value=""" & Managers.fields.item("RepID").value)
  if request.form("Manager") = Managers.fields.item("RepID").value then
   response.write(" selected ")
  end if
  response.write(""">" & Managers.fields.item("RepName").value &
"</option>")
  Managers.movenext
 wend
 %>
</select>

In this example the forms RepID is 92503 (today's date). After selecting
this particular form I printed out:

response.write request.form("Manager") & " "
Managers.fields.item("RepID").value

Low and behold my output is:
92503 92503

Yet... the test to compare these two to enable the "selected" feature,
fails.

Does anyone have an explanation?

Rob.Smith


More information about the thelist mailing list