|
 |
asp_databases thread: Getting list selection field info into a form field
Message #1 by "Kim A. Cook" <cook@a...> on Mon, 17 Apr 2000 20:20:10
|
|
I've got an access database set up with a unique identifier for each
record. I'm interested in retrieving a record, placing the values from the
record into text boxes in a form, making some changes and then posting the
form to an update ASP file. Regular text and numeric info works great.
The problem I'm having deals with a couple of fields that have been
established as selections from a short list of possibilities. I've got the
form set up with the text boxes representing the lists indicated by using
the "select" type and forming a list of the same options that occur in the
database. The form fields based on a menu list seem to default back to the
first option in the list rather than preserving the value passed from the
database. Is there any way to get the stored value from the database to
show up in the form field box and still have the list to choose from should
the field need to be changed?? (I'm currently using a pull down list in
the form).
Message #2 by "Ken Schaefer" <ken.s@a...> on Wed, 19 Apr 2000 12:20:10 +1000
|
|
Something like:
<%
Function fncSelectThis(intOptionNumber)
if objRS("field1") = intOptionNumber then
fncSelectThis = " selected"
else
fncSelectThis = " "
end if
End Function
%>
<select name="select1">
<option value="1" <%=fncSelectThis(1)%>>Option 1</option>
<option value="2" <%=fncSelectThis(2)%>>Option 2</option>
<option value="3" <%=fncSelectThis(3)%>>Option 3</option>
<option value="4" <%=fncSelectThis(4)%>>Option 4</option>
<option value="5" <%=fncSelectThis(5)%>>Option 5</option>
</select>
Cheers
Ken
----- Original Message -----
From: Kim A. Cook
To: ASP Databases <asp_databases@p...>
Sent: Monday, April 17, 2000 8:20 PM
Subject: [asp_databases] Getting list selection field info into a form field
> I've got an access database set up with a unique identifier for each
> record. I'm interested in retrieving a record, placing the values from the
> record into text boxes in a form, making some changes and then posting the
> form to an update ASP file. Regular text and numeric info works great.
> The problem I'm having deals with a couple of fields that have been
> established as selections from a short list of possibilities. I've got
the
> form set up with the text boxes representing the lists indicated by using
> the "select" type and forming a list of the same options that occur in the
> database. The form fields based on a menu list seem to default back to the
> first option in the list rather than preserving the value passed from the
> database. Is there any way to get the stored value from the database to
> show up in the form field box and still have the list to choose from
should
> the field need to be changed?? (I'm currently using a pull down list in
> the form).
>
> ---
> You are currently subscribed to asp_databases
$subst('Email.Unsub')
|
|
 |