I call upon Thine Geniuses,
When I navigate through my records. It is writing the existing record over and over to the the database. Please Help
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<!--#include file="Connections/connDB.asp" -->
<!--#include file="functions.asp"-->
<%
Dim cmdInsert__ProducerID
cmdInsert__ProducerID = ""
if(Request("ProducerID") <> "") then cmdInsert__ProducerID = Request("ProducerID")
Dim cmdInsert__LastName
cmdInsert__LastName = ""
if(Request("txtLastNameInsert") <> "") then cmdInsert__LastName = Request("txtLastNameInsert")
Dim cmdInsert__FirstName
cmdInsert__FirstName = ""
if(Request("txtFirstNameInsert") <> "") then cmdInsert__FirstName = Request("txtFirstNameInsert")
Dim cmdInsert__PreferredName
cmdInsert__PreferredName = ""
if(Request("txtPreferredNameInsert") <> "") then cmdInsert__PreferredName = Request("txtPreferredNameInsert")
Dim cmdInsert__Title
cmdInsert__Title = ""
if(Request("txtTitleInsert") <> "") then cmdInsert__Title = Request("txtTitleInsert")
Dim cmdInsert__Phone
cmdInsert__Phone = null
if(Request("txtPhoneInsert") <> "") then cmdInsert__Phone = fnParsePhoneNumber(Request("txtPhoneInsert"))
Dim cmdInsert__Ext
cmdInsert__Ext = ""
if(Request("txtExtInsert") <> "") then cmdInsert__Ext = Request("txtExtInsert")
Dim cmdInsert__Email
cmdInsert__Email = ""
if(Request("txtEmailInsert") <> "") then cmdInsert__Email = Request("txtEmailInsert")
Dim cmdInsert__Notes
cmdInsert__Notes = ""
if(Request("txtNotesInsert") <> "") then cmdInsert__Notes = Request("txtNotesInsert")
%>
<%
Dim cmdUpdate__ContactID
cmdUpdate__ContactID = ""
if(Request("hidContactID") <> "") then cmdUpdate__ContactID = Request("hidContactID")
Dim cmdUpdate__LastName
cmdUpdate__LastName = ""
if(Request("txtLastNameUpdate") <> "") then cmdUpdate__LastName = Request("txtLastNameUpdate")
Dim cmdUpdate__FirstName
cmdUpdate__FirstName = ""
if(Request("txtFirstNameUpdate") <> "") then cmdUpdate__FirstName = Request("txtFirstNameUpdate")
Dim cmdUpdate__PreferredName
cmdUpdate__PreferredName = ""
if(Request("txtPreferredNameUpdate") <> "") then cmdUpdate__PreferredName = Request("txtPreferredNameUpdate")
Dim cmdUpdate__Title
cmdUpdate__Title = ""
if(Request("txtTitleUpdate") <> "") then cmdUpdate__Title = Request("txtTitleUpdate")
Dim cmdUpdate__Phone
cmdUpdate__Phone = null
if(Request("txtPhoneUpdate") <> "") then cmdUpdate__Phone = fnParsePhoneNumber(Request("txtPhoneUpdate"))
Dim cmdUpdate__Ext
cmdUpdate__Ext = ""
if(Request("txtExtUpdate") <> "") then cmdUpdate__Ext = Request("txtExtUpdate")
Dim cmdUpdate__Email
cmdUpdate__Email = ""
if(Request("txtEmailUpdate") <> "") then cmdUpdate__Email = Request("txtEmailUpdate")
Dim cmdUpdate__Notes
cmdUpdate__Notes = ""
if(Request("txtNotesUpdate") <> "") then cmdUpdate__Notes = Request("txtNotesUpdate")
%>
<%
Dim cmdDelete__DeleteID
cmdDelete__DeleteID = "0"
if(Request("DeleteID") <> "") then
cmdDelete__DeleteID = Request("DeleteID")
Dim cmdDelete
set cmdDelete = Server.CreateObject("ADODB.Command")
cmdDelete.ActiveConnection = MM_connDB_STRING
cmdDelete.CommandText = "dbo.spProducerContactDelete"
cmdDelete.Parameters.Append cmdDelete.CreateParameter("@RETURN_VALUE", 3, 4)
cmdDelete.Parameters.Append cmdDelete.CreateParameter("@ContactID", 3, 1,4,cmdDelete__DeleteID)
cmdDelete.CommandType = 4
cmdDelete.CommandTimeout = 0
cmdDelete.Prepared = true
cmdDelete.Execute()
end if
%>
<%
If Request("butSaveInsert") <> "" Then
dim cmdInsert
set cmdInsert = Server.CreateObject("ADODB.Command")
cmdInsert.ActiveConnection = MM_connDB_STRING
cmdInsert.CommandText = "dbo.spProducerContactInsert"
cmdInsert.CommandType = 4
cmdInsert.CommandTimeout = 0
cmdInsert.Prepared = true
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@RETURN_VALUE", 3, 4)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@ProducerID", 3, 1,4,cmdInsert__ProducerID)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@LastName", 200, 1,50,cmdInsert__LastName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@FirstName", 200, 1,30,cmdInsert__FirstName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@PreferredName", 200, 1,30,cmdInsert__PreferredName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Title", 200, 1,50,cmdInsert__Title)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Phone", 20, 1,14,cmdInsert__Phone)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Ext", 200, 1,5,cmdInsert__Ext)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Email", 200, 1,50,cmdInsert__Email)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Notes", 200, 1,500,cmdInsert__Notes)
cmdInsert.Execute()
End If
%>
<%
If Request("butSaveUpdate") <> "" Then
dim cmdUpdate
set cmdUpdate = Server.CreateObject("ADODB.Command")
cmdUpdate.ActiveConnection = MM_connDB_STRING
cmdUpdate.CommandText = "dbo.spProducerContactUpdate"
cmdUpdate.CommandType = 4
cmdUpdate.CommandTimeout = 0
cmdUpdate.Prepared = true
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@RETURN_VALUE", 3, 4)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@ContactID", 3, 1,4,cmdUpdate__ContactID)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@LastName", 200, 1,50,cmdUpdate__LastName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@FirstName", 200, 1,30,cmdUpdate__FirstName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@PreferredName", 200, 1,30,cmdUpdate__PreferredName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Title", 200, 1,50,cmdUpdate__Title)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Phone", 20, 1,14,cmdUpdate__Phone)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Ext", 200, 1,5,cmdUpdate__Ext)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Email", 200, 1,50,cmdUpdate__Email)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Notes", 200, 1,500,cmdUpdate__Notes)
cmdUpdate.Execute()
End If
%>
<%
Dim Recordset1__ProducerID
Recordset1__ProducerID = "0"
If (Request("ProducerID") <> "") Then
Recordset1__ProducerID = Request("ProducerID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_connDB_STRING
Recordset1.Source = "{call dbo.spProducerContactDetailSelect(" + Replace(Recordset1__ProducerID, "'", "''") + ")}"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
If (Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (Recordset1_total = -1) Then
' count the total records by iterating through the recordset
Recordset1_total=0
While (Not Recordset1.EOF)
Recordset1_total = Recordset1_total + 1
Recordset1.MoveNext
Wend
' reset the cursor to the beginning
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
' set the number of rows displayed on this page
If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = Recordset1
MM_rsCount = Recordset1_total
MM_size = Recordset1_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index")
If (MM_param = "") Then
MM_param = Request.QueryString("offset")
End If
If (MM_param <> "") Then
MM_offset = Int(MM_param)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
Recordset1_first = MM_offset + 1
Recordset1_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (Recordset1_first > MM_rsCount) Then
Recordset1_first = MM_rsCount
End If
If (Recordset1_last > MM_rsCount) Then
Recordset1_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
MM_paramList = Split(MM_keepMove, "&")
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }
obj.visibility=v; }
}
function fnRefresh()
{
window.location.reload();
}
function fnNewRecord() {
MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show');
}
function fnEditRecord() {
//document.form1.txtPreferredName.value = 'blah';
MM_showHideLayers('laySelect','','hide','layUpdate','','show','layInsert','','hide');
}
function fnDeleteRecord() {
if (fnConfirm()) {
window.location = "producerdetail_contacts.asp?ProducerID=<%=Request("ProducerID")%>&DeleteID=" + document.frmUpdate.hidContactID.value
}
}
function fnCancelInsert() {
// Reset all fields on Insert form
document.frmInsert.reset();
// Determine whether to display Insert screen or Select (read-only) screen
<%If Recordset1.EOF and Recordset1.BOF then%>
MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show');
<%else%>
MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide');
<%end if%>
}
function fnConfirm(){
// CONFIRM REQUIRES ONE ARGUMENT
var message = "You are about to delete this producer contact. This action cannot be undone. Proceed?";
// CONFIRM IS BOOLEAN. THAT MEANS THAT
// IT RETURNS TRUE IF 'OK' IS CLICKED
// OTHERWISE IT RETURN FALSE
var return_value = confirm(message);
// TEST TO SEE IF TRUE|FALSE RETURNED
if (return_value == true) {
// YOUR 'OK' SCRIPT GOES HERE
return true
}
else {
return false
}
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
@import url("CSS/NRCG.css");
.style2 {font-size: 9px}
-->
</style>
</head>
<body onload=javascript:<%If Recordset1.EOF and Recordset1.BOF then%>MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show')<%else%>MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide')<%end if%>;MM_preloadImages('Templates/RecordNavBar/first_sunken.gif','Templates/RecordNavBar/last_sunken.gif','Templates/RecordNavBar/previous_sunken.gif','Templates/RecordNavBar/next_sunken.gif')>
<div id="laySelect" style="position:absolute; left:25px; top:25px; width:509px; height:340px; z-index:3; visibility: visible;">
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="580" border="0" cellpadding="0" cellspacing="0">
<tr height="16">
<td width="82"> <Label>Record:</Label></td>
<td width="24"><a href="<%=MM_moveFirst%>"><img src="Templates/RecordNavBar/first.gif"
alt="first record" name="first" width="23" height="16" border="0" id="first"
onmousedown="MM_swapImage('first','','Templates/RecordNavBar/first_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="24"><a href="<%=MM_movePrev%>"><img src="Templates/RecordNavBar/previous.gif"
alt="previous record" name="previous" width="23" height="16" border="0" id="previous"
onmousedown="MM_swapImage('previous','','Templates/RecordNavBar/previous_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="70">
<input name="textfield" type="text" value="<%=(Recordset1_first)%>" size="5" maxlength="6"/> </td>
<td width="24"><a href="<%=MM_moveNext%>"><img src="Templates/RecordNavBar/next.gif"
alt="next record" name="next" width="23" height="16" border="0" id="next"
onmousedown="MM_swapImage('next','','Templates/RecordNavBar/next_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="24"><a href="<%=MM_moveLast%>"><img src="Templates/RecordNavBar/last.gif"
alt="last record" name="last" width="23" height="16" border="0" id="last"
onmousedown="MM_swapImage('last','','Templates/RecordNavBar/last_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="167"> of <%=(Recordset1_total)%> </td>
<td width="43">
<input name="butNew" type="submit" class="Nav" id="butNew" onclick="javascript:fnNewRecord()" value="NEW"
/>
</td>
<td width="44">
<input name="butEdit" type="submit" class="Nav" id="butEdit" onclick="javascript:fnEditRecord()" value="EDIT">
</td>
<td width="114">
<input name="butDelete" type="submit" class="Nav" id="butDelete" onclick="javascript:fnDeleteRecord()" value="DELETE" /> </td>
<td width="114"> </td>
</tr>
</table>
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150"><label>Name (F/L)</label> </td>
<td width="350"><Span class="Data"><%=(Recordset1.Fields.Item("FirstName").Value)%></Span> <Span class="Data"><%=(Recordset1.Fields.Item("LastName").Value)%></Span> </td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("PreferredName").Value)%></Span> </td>
</tr>
<tr>
<td><label>Title</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Title").Value)%></Span> </td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td class="Data"><%=fnFormatPhoneNumber(Recordset1.Fields.Item("Phone").Value)%> / <%=(Recordset1.Fields.Item("Ext").Value)%></td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Email").Value)%></Span> </td>
</tr>
<tr>
<td><label>Notes</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Notes").Value)%></Span> </td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</div>
<div id="layUpdate" style="position:absolute; left:25px; top:25px; width:504px; height:230px; z-index:2; visibility: hidden;">
<form name="frmUpdate" id="frmUpdate" method="post" action="producerdetail_contacts.asp?ProducerID=<%=Recordset1__ProducerID%>">
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150"> </td>
<td width="250">
<input name="hidContactID" type="hidden" id="hidContactID" value="<%=(Recordset1.Fields.Item("ContactID").Value)%>" />
</td>
<td width="50"><input name="butSaveUpdate" type="submit" id="butSaveUpdate" value="Save" /></td>
<td width="50"><input name="butCancel" type="button" id="butCancel" onclick="MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide')" value="Cancel" /></td>
</tr>
<tr>
<td><label>Name (F/L)</label> </td>
<td colspan="3"><input name="txtFirstNameUpdate" type="text" id="txtFirstNameUpdate" value="<%=(Recordset1.Fields.Item("FirstName").Value)%>" />
<input name="txtLastNameUpdate" type="text" id="txtLastNameUpdate" value="<%=(Recordset1.Fields.Item("LastName").Value)%>" /></td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td colspan="3"><input name="txtPreferredNameUpdate" type="text" id="txtPreferredNameUpdate" value="<%=(Recordset1.Fields.Item("PreferredName").Value)%>" /></td>
</tr>
<tr>
<td><label>Title</label></td>
<td colspan="3"><input name="txtTitleUpdate" type="text" id="txtTitleUpdate" value="<%=(Recordset1.Fields.Item("Title").Value)%>" />
</td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td colspan="3"><input name="txtPhoneUpdate" type="text" id="txtPhoneUpdate" value="<%=fnFormatPhoneNumber(Recordset1.Fields.Item("Phone").Value)%>" />
/
<input name="txtExtUpdate" type="text" id="txtExtUpdate" value="<%=(Recordset1.Fields.Item("Ext").Value)%>" />
</td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td colspan="3"><input name="txtEmailUpdate" type="text" id="txtEmailUpdate" value="<%=(Recordset1.Fields.Item("Email").Value)%>" /></td>
</tr>
<tr>
<td><label>Notes</label></td>
<td colspan="3"><input name="txtNotesUpdate" type="text" id="txtNotesUpdate" value="<%=(Recordset1.Fields.Item("Notes").Value)%>" /></td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</form>
</div>
<div id="layInsert" style="position:absolute; left:25px; top:25; width:504; height:230; z-index:1; visibility: hidden;">
<form name="frmInsert" id="frmInsert" method="post" action="producerdetail_contacts.asp?ProducerID=<%=Recordset1__ProducerID%>">
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150" align="center"> </td>
<td width="250"><div align="right" class="style2">Required fields are highlighted in yellow. </div></td>
<td width="50" align="center">
<input name="butSaveInsert" type="submit" id="butSaveInsert" value="Save" />
</td>
<td width="50" align="center"><input name="butCancelInsert" type="button" id="butCancelInsert" onclick="javascript:fnCancelInsert()" value="Cancel" /></td>
</tr>
<tr>
<td width="150"><label>Name (F/L)</label> </td>
<td colspan="3"><input name="txtFirstNameInsert" type="text" id="txtFirstNameInsert" />
<input name="txtLastNameInsert" type="text" id="txtLastNameInsert" style="background-color:#FFFF99" /></td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td colspan="3"><input name="txtPreferredNameInsert" type="text" id="txtPreferredNameInsert" /></td>
</tr>
<tr>
<td><label>Title</label></td>
<td colspan="3"><input name="txtTitleInsert" type="text" id="txtTitleInsert" />
</td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td colspan="3"><input name="txtPhoneInsert" type="text" id="txtPhoneInsert" />
/
<input name="txtExtInsert" type="text" id="txtExtInsert" />
</td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td colspan="3"><input name="txtEmailInsert" type="text" id="txtEmailInsert" /></td>
</tr>
<tr>
<td><label>Notes</label></td>
<td colspan="3"><input name="txtNotesInsert" type="text" id="txtNotesInsert" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
When I navigate through my records. It is writing the existing record over and over to the the database. Please Help
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<!--#include file="Connections/connDB.asp" -->
<!--#include file="functions.asp"-->
<%
Dim cmdInsert__ProducerID
cmdInsert__ProducerID = ""
if(Request("ProducerID") <> "") then cmdInsert__ProducerID = Request("ProducerID")
Dim cmdInsert__LastName
cmdInsert__LastName = ""
if(Request("txtLastNameInsert") <> "") then cmdInsert__LastName = Request("txtLastNameInsert")
Dim cmdInsert__FirstName
cmdInsert__FirstName = ""
if(Request("txtFirstNameInsert") <> "") then cmdInsert__FirstName = Request("txtFirstNameInsert")
Dim cmdInsert__PreferredName
cmdInsert__PreferredName = ""
if(Request("txtPreferredNameInsert") <> "") then cmdInsert__PreferredName = Request("txtPreferredNameInsert")
Dim cmdInsert__Title
cmdInsert__Title = ""
if(Request("txtTitleInsert") <> "") then cmdInsert__Title = Request("txtTitleInsert")
Dim cmdInsert__Phone
cmdInsert__Phone = null
if(Request("txtPhoneInsert") <> "") then cmdInsert__Phone = fnParsePhoneNumber(Request("txtPhoneInsert"))
Dim cmdInsert__Ext
cmdInsert__Ext = ""
if(Request("txtExtInsert") <> "") then cmdInsert__Ext = Request("txtExtInsert")
Dim cmdInsert__Email
cmdInsert__Email = ""
if(Request("txtEmailInsert") <> "") then cmdInsert__Email = Request("txtEmailInsert")
Dim cmdInsert__Notes
cmdInsert__Notes = ""
if(Request("txtNotesInsert") <> "") then cmdInsert__Notes = Request("txtNotesInsert")
%>
<%
Dim cmdUpdate__ContactID
cmdUpdate__ContactID = ""
if(Request("hidContactID") <> "") then cmdUpdate__ContactID = Request("hidContactID")
Dim cmdUpdate__LastName
cmdUpdate__LastName = ""
if(Request("txtLastNameUpdate") <> "") then cmdUpdate__LastName = Request("txtLastNameUpdate")
Dim cmdUpdate__FirstName
cmdUpdate__FirstName = ""
if(Request("txtFirstNameUpdate") <> "") then cmdUpdate__FirstName = Request("txtFirstNameUpdate")
Dim cmdUpdate__PreferredName
cmdUpdate__PreferredName = ""
if(Request("txtPreferredNameUpdate") <> "") then cmdUpdate__PreferredName = Request("txtPreferredNameUpdate")
Dim cmdUpdate__Title
cmdUpdate__Title = ""
if(Request("txtTitleUpdate") <> "") then cmdUpdate__Title = Request("txtTitleUpdate")
Dim cmdUpdate__Phone
cmdUpdate__Phone = null
if(Request("txtPhoneUpdate") <> "") then cmdUpdate__Phone = fnParsePhoneNumber(Request("txtPhoneUpdate"))
Dim cmdUpdate__Ext
cmdUpdate__Ext = ""
if(Request("txtExtUpdate") <> "") then cmdUpdate__Ext = Request("txtExtUpdate")
Dim cmdUpdate__Email
cmdUpdate__Email = ""
if(Request("txtEmailUpdate") <> "") then cmdUpdate__Email = Request("txtEmailUpdate")
Dim cmdUpdate__Notes
cmdUpdate__Notes = ""
if(Request("txtNotesUpdate") <> "") then cmdUpdate__Notes = Request("txtNotesUpdate")
%>
<%
Dim cmdDelete__DeleteID
cmdDelete__DeleteID = "0"
if(Request("DeleteID") <> "") then
cmdDelete__DeleteID = Request("DeleteID")
Dim cmdDelete
set cmdDelete = Server.CreateObject("ADODB.Command")
cmdDelete.ActiveConnection = MM_connDB_STRING
cmdDelete.CommandText = "dbo.spProducerContactDelete"
cmdDelete.Parameters.Append cmdDelete.CreateParameter("@RETURN_VALUE", 3, 4)
cmdDelete.Parameters.Append cmdDelete.CreateParameter("@ContactID", 3, 1,4,cmdDelete__DeleteID)
cmdDelete.CommandType = 4
cmdDelete.CommandTimeout = 0
cmdDelete.Prepared = true
cmdDelete.Execute()
end if
%>
<%
If Request("butSaveInsert") <> "" Then
dim cmdInsert
set cmdInsert = Server.CreateObject("ADODB.Command")
cmdInsert.ActiveConnection = MM_connDB_STRING
cmdInsert.CommandText = "dbo.spProducerContactInsert"
cmdInsert.CommandType = 4
cmdInsert.CommandTimeout = 0
cmdInsert.Prepared = true
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@RETURN_VALUE", 3, 4)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@ProducerID", 3, 1,4,cmdInsert__ProducerID)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@LastName", 200, 1,50,cmdInsert__LastName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@FirstName", 200, 1,30,cmdInsert__FirstName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@PreferredName", 200, 1,30,cmdInsert__PreferredName)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Title", 200, 1,50,cmdInsert__Title)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Phone", 20, 1,14,cmdInsert__Phone)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Ext", 200, 1,5,cmdInsert__Ext)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Email", 200, 1,50,cmdInsert__Email)
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@Notes", 200, 1,500,cmdInsert__Notes)
cmdInsert.Execute()
End If
%>
<%
If Request("butSaveUpdate") <> "" Then
dim cmdUpdate
set cmdUpdate = Server.CreateObject("ADODB.Command")
cmdUpdate.ActiveConnection = MM_connDB_STRING
cmdUpdate.CommandText = "dbo.spProducerContactUpdate"
cmdUpdate.CommandType = 4
cmdUpdate.CommandTimeout = 0
cmdUpdate.Prepared = true
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@RETURN_VALUE", 3, 4)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@ContactID", 3, 1,4,cmdUpdate__ContactID)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@LastName", 200, 1,50,cmdUpdate__LastName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@FirstName", 200, 1,30,cmdUpdate__FirstName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@PreferredName", 200, 1,30,cmdUpdate__PreferredName)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Title", 200, 1,50,cmdUpdate__Title)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Phone", 20, 1,14,cmdUpdate__Phone)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Ext", 200, 1,5,cmdUpdate__Ext)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Email", 200, 1,50,cmdUpdate__Email)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Notes", 200, 1,500,cmdUpdate__Notes)
cmdUpdate.Execute()
End If
%>
<%
Dim Recordset1__ProducerID
Recordset1__ProducerID = "0"
If (Request("ProducerID") <> "") Then
Recordset1__ProducerID = Request("ProducerID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_connDB_STRING
Recordset1.Source = "{call dbo.spProducerContactDetailSelect(" + Replace(Recordset1__ProducerID, "'", "''") + ")}"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
If (Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (Recordset1_total = -1) Then
' count the total records by iterating through the recordset
Recordset1_total=0
While (Not Recordset1.EOF)
Recordset1_total = Recordset1_total + 1
Recordset1.MoveNext
Wend
' reset the cursor to the beginning
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
' set the number of rows displayed on this page
If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
Recordset1_numRows = Recordset1_total
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last = Recordset1_first + Recordset1_numRows - 1
If (Recordset1_first > Recordset1_total) Then
Recordset1_first = Recordset1_total
End If
If (Recordset1_last > Recordset1_total) Then
Recordset1_last = Recordset1_total
End If
End If
%>
<%
Dim MM_paramName
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs
Dim MM_rsCount
Dim MM_size
Dim MM_uniqueCol
Dim MM_offset
Dim MM_atTotal
Dim MM_paramIsDefined
Dim MM_param
Dim MM_index
Set MM_rs = Recordset1
MM_rsCount = Recordset1_total
MM_size = Recordset1_numRows
MM_uniqueCol = ""
MM_paramName = ""
MM_offset = 0
MM_atTotal = false
MM_paramIsDefined = false
If (MM_paramName <> "") Then
MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined And MM_rsCount <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param = Request.QueryString("index")
If (MM_param = "") Then
MM_param = Request.QueryString("offset")
End If
If (MM_param <> "") Then
MM_offset = Int(MM_param)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount <> -1) Then
If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' move the cursor to the selected record
MM_index = 0
While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
If (MM_rs.EOF) Then
MM_offset = MM_index ' set MM_offset to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount = -1) Then
' walk to the end of the display range for this page
MM_index = MM_offset
While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount and MM_size
If (MM_rs.EOF) Then
MM_rsCount = MM_index
If (MM_size < 0 Or MM_size > MM_rsCount) Then
MM_size = MM_rsCount
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs.EOF And Not MM_paramIsDefined) Then
If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
If ((MM_rsCount Mod MM_size) > 0) Then
MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
Else
MM_offset = MM_rsCount - MM_size
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs.CursorType > 0) Then
MM_rs.MoveFirst
Else
MM_rs.Requery
End If
' move the cursor to the selected record
MM_index = 0
While (Not MM_rs.EOF And MM_index < MM_offset)
MM_rs.MoveNext
MM_index = MM_index + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
Recordset1_first = MM_offset + 1
Recordset1_last = MM_offset + MM_size
If (MM_rsCount <> -1) Then
If (Recordset1_first > MM_rsCount) Then
Recordset1_first = MM_rsCount
End If
If (Recordset1_last > MM_rsCount) Then
Recordset1_last = MM_rsCount
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove
Dim MM_moveParam
Dim MM_moveFirst
Dim MM_moveLast
Dim MM_moveNext
Dim MM_movePrev
Dim MM_urlStr
Dim MM_paramList
Dim MM_paramIndex
Dim MM_nextParam
MM_keepMove = MM_keepBoth
MM_moveParam = "index"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size > 1) Then
MM_moveParam = "offset"
If (MM_keepMove <> "") Then
MM_paramList = Split(MM_keepMove, "&")
MM_keepMove = ""
For MM_paramIndex = 0 To UBound(MM_paramList)
MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
End If
Next
If (MM_keepMove <> "") Then
MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove <> "") Then
MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&"
End If
MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
MM_moveFirst = MM_urlStr & "0"
MM_moveLast = MM_urlStr & "-1"
MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
If (MM_offset - MM_size < 0) Then
MM_movePrev = MM_urlStr & "0"
Else
MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible'v=='hide')?'hidden':v; }
obj.visibility=v; }
}
function fnRefresh()
{
window.location.reload();
}
function fnNewRecord() {
MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show');
}
function fnEditRecord() {
//document.form1.txtPreferredName.value = 'blah';
MM_showHideLayers('laySelect','','hide','layUpdate','','show','layInsert','','hide');
}
function fnDeleteRecord() {
if (fnConfirm()) {
window.location = "producerdetail_contacts.asp?ProducerID=<%=Request("ProducerID")%>&DeleteID=" + document.frmUpdate.hidContactID.value
}
}
function fnCancelInsert() {
// Reset all fields on Insert form
document.frmInsert.reset();
// Determine whether to display Insert screen or Select (read-only) screen
<%If Recordset1.EOF and Recordset1.BOF then%>
MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show');
<%else%>
MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide');
<%end if%>
}
function fnConfirm(){
// CONFIRM REQUIRES ONE ARGUMENT
var message = "You are about to delete this producer contact. This action cannot be undone. Proceed?";
// CONFIRM IS BOOLEAN. THAT MEANS THAT
// IT RETURNS TRUE IF 'OK' IS CLICKED
// OTHERWISE IT RETURN FALSE
var return_value = confirm(message);
// TEST TO SEE IF TRUE|FALSE RETURNED
if (return_value == true) {
// YOUR 'OK' SCRIPT GOES HERE
return true
}
else {
return false
}
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById; return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
@import url("CSS/NRCG.css");
.style2 {font-size: 9px}
-->
</style>
</head>
<body onload=javascript:<%If Recordset1.EOF and Recordset1.BOF then%>MM_showHideLayers('laySelect','','hide','layUpdate','','hide','layInsert','','show')<%else%>MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide')<%end if%>;MM_preloadImages('Templates/RecordNavBar/first_sunken.gif','Templates/RecordNavBar/last_sunken.gif','Templates/RecordNavBar/previous_sunken.gif','Templates/RecordNavBar/next_sunken.gif')>
<div id="laySelect" style="position:absolute; left:25px; top:25px; width:509px; height:340px; z-index:3; visibility: visible;">
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="580" border="0" cellpadding="0" cellspacing="0">
<tr height="16">
<td width="82"> <Label>Record:</Label></td>
<td width="24"><a href="<%=MM_moveFirst%>"><img src="Templates/RecordNavBar/first.gif"
alt="first record" name="first" width="23" height="16" border="0" id="first"
onmousedown="MM_swapImage('first','','Templates/RecordNavBar/first_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="24"><a href="<%=MM_movePrev%>"><img src="Templates/RecordNavBar/previous.gif"
alt="previous record" name="previous" width="23" height="16" border="0" id="previous"
onmousedown="MM_swapImage('previous','','Templates/RecordNavBar/previous_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="70">
<input name="textfield" type="text" value="<%=(Recordset1_first)%>" size="5" maxlength="6"/> </td>
<td width="24"><a href="<%=MM_moveNext%>"><img src="Templates/RecordNavBar/next.gif"
alt="next record" name="next" width="23" height="16" border="0" id="next"
onmousedown="MM_swapImage('next','','Templates/RecordNavBar/next_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="24"><a href="<%=MM_moveLast%>"><img src="Templates/RecordNavBar/last.gif"
alt="last record" name="last" width="23" height="16" border="0" id="last"
onmousedown="MM_swapImage('last','','Templates/RecordNavBar/last_sunken.gif',1)"
onmouseup="MM_swapImgRestore()"
onmouseover="MM_swapImgRestore()" onmouseout="MM_swapImgRestore()" /></a></td>
<td width="167"> of <%=(Recordset1_total)%> </td>
<td width="43">
<input name="butNew" type="submit" class="Nav" id="butNew" onclick="javascript:fnNewRecord()" value="NEW"
/>
</td>
<td width="44">
<input name="butEdit" type="submit" class="Nav" id="butEdit" onclick="javascript:fnEditRecord()" value="EDIT">
</td>
<td width="114">
<input name="butDelete" type="submit" class="Nav" id="butDelete" onclick="javascript:fnDeleteRecord()" value="DELETE" /> </td>
<td width="114"> </td>
</tr>
</table>
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150"><label>Name (F/L)</label> </td>
<td width="350"><Span class="Data"><%=(Recordset1.Fields.Item("FirstName").Value)%></Span> <Span class="Data"><%=(Recordset1.Fields.Item("LastName").Value)%></Span> </td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("PreferredName").Value)%></Span> </td>
</tr>
<tr>
<td><label>Title</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Title").Value)%></Span> </td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td class="Data"><%=fnFormatPhoneNumber(Recordset1.Fields.Item("Phone").Value)%> / <%=(Recordset1.Fields.Item("Ext").Value)%></td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Email").Value)%></Span> </td>
</tr>
<tr>
<td><label>Notes</label></td>
<td><Span class="Data"><%=(Recordset1.Fields.Item("Notes").Value)%></Span> </td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</div>
<div id="layUpdate" style="position:absolute; left:25px; top:25px; width:504px; height:230px; z-index:2; visibility: hidden;">
<form name="frmUpdate" id="frmUpdate" method="post" action="producerdetail_contacts.asp?ProducerID=<%=Recordset1__ProducerID%>">
<% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150"> </td>
<td width="250">
<input name="hidContactID" type="hidden" id="hidContactID" value="<%=(Recordset1.Fields.Item("ContactID").Value)%>" />
</td>
<td width="50"><input name="butSaveUpdate" type="submit" id="butSaveUpdate" value="Save" /></td>
<td width="50"><input name="butCancel" type="button" id="butCancel" onclick="MM_showHideLayers('laySelect','','show','layUpdate','','hide','layInsert','','hide')" value="Cancel" /></td>
</tr>
<tr>
<td><label>Name (F/L)</label> </td>
<td colspan="3"><input name="txtFirstNameUpdate" type="text" id="txtFirstNameUpdate" value="<%=(Recordset1.Fields.Item("FirstName").Value)%>" />
<input name="txtLastNameUpdate" type="text" id="txtLastNameUpdate" value="<%=(Recordset1.Fields.Item("LastName").Value)%>" /></td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td colspan="3"><input name="txtPreferredNameUpdate" type="text" id="txtPreferredNameUpdate" value="<%=(Recordset1.Fields.Item("PreferredName").Value)%>" /></td>
</tr>
<tr>
<td><label>Title</label></td>
<td colspan="3"><input name="txtTitleUpdate" type="text" id="txtTitleUpdate" value="<%=(Recordset1.Fields.Item("Title").Value)%>" />
</td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td colspan="3"><input name="txtPhoneUpdate" type="text" id="txtPhoneUpdate" value="<%=fnFormatPhoneNumber(Recordset1.Fields.Item("Phone").Value)%>" />
/
<input name="txtExtUpdate" type="text" id="txtExtUpdate" value="<%=(Recordset1.Fields.Item("Ext").Value)%>" />
</td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td colspan="3"><input name="txtEmailUpdate" type="text" id="txtEmailUpdate" value="<%=(Recordset1.Fields.Item("Email").Value)%>" /></td>
</tr>
<tr>
<td><label>Notes</label></td>
<td colspan="3"><input name="txtNotesUpdate" type="text" id="txtNotesUpdate" value="<%=(Recordset1.Fields.Item("Notes").Value)%>" /></td>
</tr>
</table>
<% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %>
</form>
</div>
<div id="layInsert" style="position:absolute; left:25px; top:25; width:504; height:230; z-index:1; visibility: hidden;">
<form name="frmInsert" id="frmInsert" method="post" action="producerdetail_contacts.asp?ProducerID=<%=Recordset1__ProducerID%>">
<table width="500" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="150" align="center"> </td>
<td width="250"><div align="right" class="style2">Required fields are highlighted in yellow. </div></td>
<td width="50" align="center">
<input name="butSaveInsert" type="submit" id="butSaveInsert" value="Save" />
</td>
<td width="50" align="center"><input name="butCancelInsert" type="button" id="butCancelInsert" onclick="javascript:fnCancelInsert()" value="Cancel" /></td>
</tr>
<tr>
<td width="150"><label>Name (F/L)</label> </td>
<td colspan="3"><input name="txtFirstNameInsert" type="text" id="txtFirstNameInsert" />
<input name="txtLastNameInsert" type="text" id="txtLastNameInsert" style="background-color:#FFFF99" /></td>
</tr>
<tr>
<td><label>Preferred Name</label> </td>
<td colspan="3"><input name="txtPreferredNameInsert" type="text" id="txtPreferredNameInsert" /></td>
</tr>
<tr>
<td><label>Title</label></td>
<td colspan="3"><input name="txtTitleInsert" type="text" id="txtTitleInsert" />
</td>
</tr>
<tr>
<td><label>Phone/Ext</label></td>
<td colspan="3"><input name="txtPhoneInsert" type="text" id="txtPhoneInsert" />
/
<input name="txtExtInsert" type="text" id="txtExtInsert" />
</td>
</tr>
<tr>
<td><label>E-mail</label></td>
<td colspan="3"><input name="txtEmailInsert" type="text" id="txtEmailInsert" /></td>
</tr>
<tr>
<td><label>Notes</label></td>
<td colspan="3"><input name="txtNotesInsert" type="text" id="txtNotesInsert" /></td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>