digiti0
05-14-2003, 10:30 PM
Could someone please look at the following code for a select box. When you drop down and change the value in the box, the asp application gets redirected back to itself with the new value in request.querystring("jobid"). When the page is redisplayed i want to see the new jobid showing in the select box. So on reentry to the application i move Request.Querystring("jobid") to the variable JobID. When I'm building the options in the select, I compare the job id's that i'm reading in from a database to what's in JobID and designate the matching one as the SELECTED option. But the select box always displays the first option in the list no matter which one matched JobID. What am I doing wrong? Thanks for your help
<select size="1" name="url" onchange="window.location=this.options[this.selectedIndex].value">
<% if UserAppsExist then %>
<% oRsUserApps.MoveFirst %>
<% while not oRsUserApps.EOF %>
<% if oRsUserApps.Fields("UAJobID") = JobID then %>
<option value="jobapplfill.asp?jobid=<% =oRsUserApps.Fields("UAJobID") %>&first_time=Y" selected>
<% =oRsUserApps.Fields("UAJobID") %></option>
<% else %>
<option value="jobapplfill.asp?jobid=<% =oRsUserApps.Fields("UAJobID") %>&first_time=Y">
<% =oRsUserApps.Fields("UAJobID") %></option>
<% end if %>
<% oRsUserApps.MoveNext %>
<% wend %>
<% else %>
<option selected value="jobapplfill.asp?jobid=<% =JobID %>&first_time=Y"><% =JobID %></option>
<% end if %>
</select>
<select size="1" name="url" onchange="window.location=this.options[this.selectedIndex].value">
<% if UserAppsExist then %>
<% oRsUserApps.MoveFirst %>
<% while not oRsUserApps.EOF %>
<% if oRsUserApps.Fields("UAJobID") = JobID then %>
<option value="jobapplfill.asp?jobid=<% =oRsUserApps.Fields("UAJobID") %>&first_time=Y" selected>
<% =oRsUserApps.Fields("UAJobID") %></option>
<% else %>
<option value="jobapplfill.asp?jobid=<% =oRsUserApps.Fields("UAJobID") %>&first_time=Y">
<% =oRsUserApps.Fields("UAJobID") %></option>
<% end if %>
<% oRsUserApps.MoveNext %>
<% wend %>
<% else %>
<option selected value="jobapplfill.asp?jobid=<% =JobID %>&first_time=Y"><% =JobID %></option>
<% end if %>
</select>