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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with this one please 1

Status
Not open for further replies.

AGNEW2PRG

Technical User
Aug 5, 2003
98
AE
Hi,

I have a update form that populates fields from a database. I can populate the text fields from the database without any problem. However, I would like to set the selection value to the value of the record in the database. Is this possible ?

I have attached the code below should it help understand what I'm trying to achieve.


<table class="table" width="600">

<form name="form1" ID="form1" method="post" action="taskupd.asp">

<input type="hidden" name="ID" value=<%=rsAction("ID")%> >
<input type="hidden" name="customer" value=<%=rsAction("actdate")%> >

<th><tr width="100" valign="top"><td>Action:</td></th>
<td><textarea rows="5" cols="20" name="action"><%=rsAction("action")%></textarea></td></tr>

<tr><td valign="top">Notes:</td>
<td><textarea rows="5" cols="20" name="notes"><%=rsAction("notes")%></textarea></td></tr>

<tr><td>Status :</td><td><select name="status">
<option value="1" >Stopped</option>
<option value="2">In Progress</option>
<option value="3">Completed</option>
</select>
</td></tr>

<tr><td></td><td>
<input type="button" value="Cancel" onclick=location.href="tasksef.asp"><space>
<input type="submit" name="Submit" value="Update Record"</td></tr>

</table>

Thanks in Advance...

" New To Programming - Learning Fast :)
 
<td>Status :</td><td><select name="status">
<% if rsAction("status") = "1" then key="Selected" else key = ""%>
<option value="1" <%=key%>>Stopped</option>
<% if rsAction("status") = "1" then key="Selected" else key = ""%>
<option value="2" <%=key%>>In Progress</option>
<% if rsAction("status") = "1" then key="Selected" else key = ""%>
<option value="3" <%=key%>>Completed</option>
</select>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Oops!
Code:
<td>Status :</td><td><select name="status">
[red]<% if rsAction("status") = "1" then key="Selected" else key = ""%>[/red]
   <option value="1" <%=key%>>Stopped</option>
[red]<% if rsAction("status") = "2" then key="Selected" else key = ""%>[/red]
   <option value="2" <%=key%>>In Progress</option>
[red]<% if rsAction("status") = "3" then key="Selected" else key = ""%>[/red]
   <option value="3" <%=key%>>Completed</option>
</select>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Perfect,

works well.. thanks !!

Regards

" New To Programming - Learning Fast :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top