Print Page | Close Window

Problem with Combo box

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7133
Printed Date: 31 March 2026 at 4:31pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Problem with Combo box
Posted By: stevem2003
Subject: Problem with Combo box
Date Posted: 10 November 2003 at 6:56am

Hi,

I have several combo/ pull down boxes in my forms, but when I use one of these in an amend script, the combo box only displays the first item in the combo, not the value recorded in the database.

Anyone know how to resolve this?

I have the following code in the combo box:-

<select name="timetaken" class="midgreen" value="<%=rs("timetaken")%>">
          <option value="5">5</option>
          <option value="10">10</option>
          <option value="15">15</option>
          <option value="20">20</option>
          <option value="25">25</option>
          <option value="30">30</option>
   <option value="450">450</option>
   <option value="2250">2250</option>
        </select>

TIA

Steve



-------------
There's no point running if you're on the wrong road!



Replies:
Posted By: ljamal
Date Posted: 10 November 2003 at 7:42am
Try
<select name="timetaken" class="midgreen">
<option value="5" <% if Clng(rs("timetaken"))=5 then Response.Write " selected" end if%>>5</option>
<option value="10" <% if Clng(rs("timetaken"))=10 then Response.Write " selected" end if%>>15</option>
<option value="20" <% if Clng(rs("timetaken"))=20 then Response.Write " selected" end if%>>20</option>
<option value="25" <% if Clng(rs("timetaken"))=25 then Response.Write " selected" end if%>>25</option>
<option value="30" <% if Clng(rs("timetaken"))=30 then Response.Write " selected" end if%>>30</option>
<option value="450" <% if Clng(rs("timetaken"))=450 then Response.Write " selected" end if%>>5</option>
<option value="2250" <% if Clng(rs("timetaken"))=2250 then Response.Write " selected" end if%>>2250</option>
</select>

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: stevem2003
Date Posted: 10 November 2003 at 7:55am

Many Thanks

Works a treatSmile



-------------
There's no point running if you're on the wrong road!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net