Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT filled from database doesn't display 1

Status
Not open for further replies.

datawise

IS-IT--Management
Sep 14, 2001
27
0
0
EU
Really stumped with this one. I am displaying records from a database on a form. I have a status Select box with three options hard coded. I pre fill the box from the database, but the select box always shows the first option. I have put the same status value in plain text beside it and it displays fine.

Anyone come across this one??
 
I'm sorry, but I don't understand your question.

Could you be a bit more specific as to what you have, and what you want? Maybe a little bit of code might be helpful.

:)
paul
penny1.gif
penny1.gif
 
<td COLSPAN=&quot;2&quot;><input TYPE=&quot;Submit&quot; NAME=&quot;fp_submit&quot; value=&quot;Update&quot;> Status: <%=rs.fields(&quot;Status&quot;)%></td>
<td><b>Status:</b></td>
<td>
<p align=&quot;right&quot;><select size=&quot;1&quot; name=&quot;txtStatus&quot; value = &quot;<%=rs.Fields(&quot;Status&quot;)%>&quot; >
<option value = &quot;Open&quot;>Open
<option value = &quot;Resolved&quot;>Resolved
<option value = &quot;Reassign&quot;>Reassign
</select></td>
This is the relevant chunk from the form: When I put the field 'status' in plain text just after the submit button it works fine, but when I put the same value in the select box, the box always shows the first option value.

Ta
 
Yes it dosen't work like what u r expecting. U need to check the value at each of the option tag and if value matches then u need to select that option and hence the value of the select will be set. It will be something like this :

<select size=&quot;1&quot; name=&quot;txtStatus&quot; >
<option value=&quot;Open&quot; <%if strcomp(rs.Fields(&quot;Status&quot;),&quot;Open&quot;,vbtextcompare)=0 then response.write(&quot;selected&quot;)%>&quot; >Open
<option value=&quot;Resolved&quot; <%if strcomp(rs.Fields(&quot;Status&quot;),&quot;Resolved&quot;,vbtextcompare)=0 then response.write(&quot;selected&quot;)%>&quot; >Resolved
<option value=&quot;Reassign&quot; <%if strcomp(rs.Fields(&quot;Status&quot;),&quot;Reassign&quot;,vbtextcompare)=0 then response.write(&quot;selected&quot;)%>&quot; >Reassign
</select>


Any better ideas?

srinu...
 
You should close the option off too </option> gsc1ugs
&quot;Cant see wood for tree's...!&quot;
 
Problem is I wanted to display values from the database which I don't want the user to be able to choose. I think I'll just have to display the current status in a box above and restrict the choices using a select below.

Thanks for your help - I understand how it works now. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top