drop down list box in edit.asp

D

DenWebs

Hello,
In my submission form I have a few fields that include drop down list boxes.
I duplicated these list boxes on the edit.asp page. However, when using the
database editor I noticed that when you go to edit an existing record that
the record associated with the given drop down list ends up changing to the
first choice in the drop down list. How can I make it so the field record
reflects what the original data entry was? It poses a major problem when
editing a given record because for example if a persons name was original
Peterson but the first name in the drop down list on the edit.asp page
happens to be Reynolds, than the record automatically chooses Reynolds when
you click on the edit button. Thank you in advance for your assistance.
 
G

Guest

Thank you for the quick response. The problem is that it sort of defeats the
purpose of being an edit page if I make those fields read only.
 
T

Thomas A. Rowe

Why would you list individual's names in a drop down, these should be single line text fields.
A drop down field would be use for something Gender: Male | Female.

To populate the drop down with the value from the database and the other choices do the following:
<select size="1" name="Gender">
<option value="<%=RecordSet("Gender")%>"><%=RecordSet("Gender")%></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>

Where RecordSet is the name of the record set that current populating the edit fields.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
G

Guest

Thomas,
I think I gave you a bad example. The actual code for the drop down list is:
<select size="1" name="Ship_to_Location_Code">
<option <% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
<% end if %> value="ADC">Austin Design Center</option>
<option <% if "Option 2" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
<% end if %> value="BDC">Boston Design Center</option>
<option <% if "Option 3" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
<% end if %> value="CSDC">Colorado Springs Design Center</option>
</select>
 
T

Thomas A. Rowe

I need to see more of your page, as what you have pasted below doesn't make sense to me.

What is actually stored in the "Ship_to_Location_Code" field in the database?
What is "Option 1", etc. ?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
S

Stefan B Rusynko

Poor coding that does nothing (empty if statement)
Break it down to look at what you are doing w/ the ASP code

<% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
...................Nothing here mean do nothing
<% end if %>

You probably mean to be doing something like

<select size="1" name="Ship_to_Location_Code">
<option <% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="ADC">Austin Design Center</option>
<option <% if "Option 2" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="BDC">Boston Design Center</option>
<option <% if "Option 3" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="CSDC">Colorado Springs Design Center</option>
</select>

- none of which prevents the user from changing the selected option in the form
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Thomas,
| I think I gave you a bad example. The actual code for the drop down list is:
| <select size="1" name="Ship_to_Location_Code">
| <option <% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="ADC">Austin Design Center</option>
| <option <% if "Option 2" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="BDC">Boston Design Center</option>
| <option <% if "Option 3" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="CSDC">Colorado Springs Design Center</option>
| </select>
|
| --
| DAU73
|
|
| "Thomas A. Rowe" wrote:
|
| > Why would you list individual's names in a drop down, these should be single line text fields.
| > A drop down field would be use for something Gender: Male | Female.
| >
| > To populate the drop down with the value from the database and the other choices do the following:
| > <select size="1" name="Gender">
| > <option value="<%=RecordSet("Gender")%>"><%=RecordSet("Gender")%></option>
| > <option value="Male">Male</option>
| > <option value="Female">Female</option>
| > </select>
| >
| > Where RecordSet is the name of the record set that current populating the edit fields.
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | > > Thank you for the quick response. The problem is that it sort of defeats the
| > > purpose of being an edit page if I make those fields read only.
| > >
| > >
| > > "Kathleen Anderson [MVP - FrontPage]" wrote:
| > >
| > >> You could make that field a read-only text box.
| > >>
| > >> --
| > >>
| > >> ~ Kathleen Anderson
| > >> Microsoft MVP - FrontPage
| > >> Spider Web Woman Designs
| > >> web: http://www.spiderwebwoman.com/resources/
| > >> FrontPage Support: http://www.frontpagemvps.com/
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > Hello,
| > >> > In my submission form I have a few fields that include drop down list
| > >> > boxes. I duplicated these list boxes on the edit.asp page. However, when
| > >> > using the database editor I noticed that when you go to edit an existing
| > >> > record that the record associated with the given drop down list ends up
| > >> > changing to the first choice in the drop down list. How can I make it so
| > >> > the field record reflects what the original data entry was? It poses a
| > >> > major problem when editing a given record because for example if a persons
| > >> > name was original Peterson but the first name in the drop down list on the
| > >> > edit.asp page happens to be Reynolds, than the record automatically
| > >> > chooses Reynolds when you click on the edit button. Thank you in advance
| > >> > for your assistance.
| > >> >
| > >>
| > >>
| > >>
| >
| >
| >
 
G

Guest

Thank you all for your assistance on this matter.

Stefan B Rusynko said:
Poor coding that does nothing (empty if statement)
Break it down to look at what you are doing w/ the ASP code

<% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
...................Nothing here mean do nothing
<% end if %>

You probably mean to be doing something like

<select size="1" name="Ship_to_Location_Code">
<option <% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="ADC">Austin Design Center</option>
<option <% if "Option 2" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="BDC">Boston Design Center</option>
<option <% if "Option 3" = FP_Field(fp_rs,"Ship_to_Location_Code") then %> selected
<% end if %> value="CSDC">Colorado Springs Design Center</option>
</select>

- none of which prevents the user from changing the selected option in the form
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Thomas,
| I think I gave you a bad example. The actual code for the drop down list is:
| <select size="1" name="Ship_to_Location_Code">
| <option <% if "Option 1" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="ADC">Austin Design Center</option>
| <option <% if "Option 2" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="BDC">Boston Design Center</option>
| <option <% if "Option 3" = FP_Field(fp_rs,"Ship_to_Location_Code") then %>
| <% end if %> value="CSDC">Colorado Springs Design Center</option>
| </select>
|
| --
| DAU73
|
|
| "Thomas A. Rowe" wrote:
|
| > Why would you list individual's names in a drop down, these should be single line text fields.
| > A drop down field would be use for something Gender: Male | Female.
| >
| > To populate the drop down with the value from the database and the other choices do the following:
| > <select size="1" name="Gender">
| > <option value="<%=RecordSet("Gender")%>"><%=RecordSet("Gender")%></option>
| > <option value="Male">Male</option>
| > <option value="Female">Female</option>
| > </select>
| >
| > Where RecordSet is the name of the record set that current populating the edit fields.
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > ==============================================
| > If you feel your current issue is a results of installing
| > a Service Pack or security update, please contact
| > Microsoft Product Support Services:
| > http://support.microsoft.com
| > If the problem can be shown to have been caused by a
| > security update, then there is usually no charge for the call.
| > ==============================================
| >
| > | > > Thank you for the quick response. The problem is that it sort of defeats the
| > > purpose of being an edit page if I make those fields read only.
| > >
| > >
| > > "Kathleen Anderson [MVP - FrontPage]" wrote:
| > >
| > >> You could make that field a read-only text box.
| > >>
| > >> --
| > >>
| > >> ~ Kathleen Anderson
| > >> Microsoft MVP - FrontPage
| > >> Spider Web Woman Designs
| > >> web: http://www.spiderwebwoman.com/resources/
| > >> FrontPage Support: http://www.frontpagemvps.com/
| > >>
| > >>
| > >>
| > >>
| > >> | > >> > Hello,
| > >> > In my submission form I have a few fields that include drop down list
| > >> > boxes. I duplicated these list boxes on the edit.asp page. However, when
| > >> > using the database editor I noticed that when you go to edit an existing
| > >> > record that the record associated with the given drop down list ends up
| > >> > changing to the first choice in the drop down list. How can I make it so
| > >> > the field record reflects what the original data entry was? It poses a
| > >> > major problem when editing a given record because for example if a persons
| > >> > name was original Peterson but the first name in the drop down list on the
| > >> > edit.asp page happens to be Reynolds, than the record automatically
| > >> > chooses Reynolds when you click on the edit button. Thank you in advance
| > >> > for your assistance.
| > >> >
| > >>
| > >>
| > >>
| >
| >
| >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top