Augie Dawg said:
Jim:
I did as you suggested, placing the (appropriately modified) script after
the SUBMIT button definition but before the </form> tag using the INSERT
HTML Web component, and nothing happened. I also placed the script after
the </form> tag, and that didn't work either, I'm still seeing the first
entry in the database column as opposed to the current value. Am I
misunderstanding your directions, or did I not clearly state my problem? In
case it's the latter, I'm thinking I need to be able to somehow modify the
drop-down list properties to include an entry that would show the currently
selected record first.
I'm posting the page I used for testing below. It uses the "Sample"
Northwind database. Extraneous line endings may keep it from working
on your system but you should get the idea.
You can't modify the drop-down list properties because the DRW
manufactures the drop-down list's HTML on the fly. That's why I had to
write JavaScript to look at the values in the completed list and set
the selectedIndex property to the one that contains the previous
value.
Are you sure you changed the name CategoryID to thE name of your
drop-down list in all four places?
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252">
<title>DRW Drop-Down List with Memory</title>
</head>
<body>
<form>
<nobr><!--webbot bot="DatabaseRegionStart"
s-columnnames="CategoryID,CategoryName,Description"
s-columntypes="3,202,203" s-dataconnection="Sample"
b-tableformat="FALSE" b-menuformat="TRUE"
s-menuchoice="CategoryName" s-menuvalue="CategoryID"
b-tableborder="TRUE" b-tableexpand="TRUE"
b-tableheader="TRUE" b-listlabels="TRUE"
b-listseparator="TRUE" i-listformat="0"
b-makeform="FALSE" s-recordsource="Categories"
s-displaycolumns="CategoryID,CategoryName" s-criteria
s-order s-sql="SELECT * FROM Categories"
b-procedure="FALSE" clientside suggestedext="asp"
s-defaultfields s-norecordsfound="No records returned."
i-maxrecords="256" i-groupsize="0" botid="0"
u-dblib="../_fpclass/fpdblib.inc"
u-dbrgn1="../_fpclass/fpdbrgn1.inc"
u-dbrgn2="../_fpclass/fpdbrgn2.inc"
preview=" <span style="color: rgb(0,0,0); background-color:
rgb(255,255,0)">Database</span> "
startspan --><!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The
Database Results component on this page is unable to display database
content. The page must have a filename ending in '.asp', and the web
must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Categories"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="Sample"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="CategoryName"
fp_sMenuValue="CategoryID"
fp_sColTypes="&CategoryID=3&CategoryName=202&Description=203&"
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--webbot bot="DatabaseRegionStart" endspan
i-checksum="47909" --><select name="CategoryID" size="1">
<!--webbot bot="AspInclude" clientside
u-incfile="../_fpclass/fpdbrgn1.inc" startspan --><!--#include
file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="AspInclude" endspan i-checksum="56958" -->
<option value="<%=FP_FieldHTML(fp_rs,"CategoryID")%>"><%=FP_FieldHTML(fp_rs,"CategoryName")%>
</option>
<!--webbot bot="AspInclude" clientside
u-incfile="../_fpclass/fpdbrgn2.inc" startspan --><!--#include
file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="AspInclude" endspan i-checksum="57022" -->
</select><!--webbot bot="DatabaseRegionEnd"
b-tableformat="FALSE" b-menuformat="TRUE"
u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0"
clientside
preview=" <span style="color: rgb(0,0,0); background-color:
rgb(255,255,0)">Results</span> "
startspan --><!--webbot bot="DatabaseRegionEnd"
endspan --></nobr>
<input type="submit" name="btnSub" value="Submit">
<script>
for (i = 0;
i < document.forms[0].CategoryID.options.length - 1;
i++) {
if (document.forms[0].CategoryID.options
.value
== "<%=request("CategoryID")%>"){
document.forms[0].CategoryID.selectedIndex = i;
break;
}
}
</script>
</form>
</body>
</html>
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------