I am sorry sheco. I realize this might be flagged but I worked at you for a week on this and I am not advanced enough to put it all together.
I am posting my entire page because I just don't get it. My code is slightly different than your scenario.
Can you help me edit this?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/.asp" -->
<!--#include file=".asp" -->
<!-- #include file=".asp" -->
<% 'Open the database.
call OpenDB()
week = Request("week")
if not IsNumeric(week) then
week = CurrentWeek()
else
week = Round(week)
if week < 1 or week > NumberOfWeeks() then
week = CurrentWeek()
end if
end if
%>
<%
call OpenDB()
sql = "QUERY"
set rs = DbConn.Execute(sql)
strWeek = rs.Fields("Week").value
%>
<%
If Request("Submit") <> "" Then
intRecIDs = Replace(Request("hidRecIDs"), "*", "") ' remove all the asterisks, to create a list like this: 2, 5, 8, 9 etc.
arrRecIDs = Split(intRecIDs, ", ") ' Create an array, wich will contain just the IDs of the records we need to update
For i = 0 to Ubound(arrRecIDs) ' Loop trough the array
strText = Replace(Request("txtText" & arrRecIDs(i)), "'", "''")
intNum = Replace(Request("txtNum" & arrRecIDs(i)), "'", "''")
set commUpdate = Server.CreateObject("ADODB.Command")
commUpdate.ActiveConnection = CONNECTION
commUpdate.CommandType = 1
commUpdate.CommandTimeout = 0
commUpdate.Prepared = true
commUpdate.Execute()
Next
call OpenDB()
dim strTieBreakerTotal
strTieBreakerTotal = Request.Form("txtTieBreakerTotal")
if strTieBreakerTotal = "" then
sql = ""QUERY"
""
set rs = DbConn.Execute(sql)
set rs = nothing
else
sql = "QUERY"
set rs = DbConn.Execute(sql)
set rs = nothing
end if
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "conneciton
Recordset1.Source = ""QUERY"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_XXXX_STRING
MM_editTable = "XXXXnet.Picks"
MM_editColumn = "GameID"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "Picks.asp"
MM_fieldsStr = "txtTieBreakerTotal|value"
MM_columnsStr = "TieBreakerTotal|none,none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_XXXX_STRING
Recordset2.Source = ""QUERY"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()
Recordset2_numRows = 0
%>
<script language="JavaScript">
<!--
// When the value in a textfield is changed, notice the onChange="RecUpdate('<%= intRecID %>')"
// on each of the textfields, the value of the Record ID associated with that field
// is passed to the RecUpdate function. First the value is surounded with 2 asterisks e.g. *6*
// This is so that *1* can be distinguished from *10*, *11* etc.
function RecUpdate(RecID){
var ThisID = "*" + (RecID) + "*"
if (document.form1.hidRecIDs.value == ""){ // If the hidden field is empty
document.form1.hidRecIDs.value = (ThisID) // Store the value in the hidden field (hidRecIDs) as it is.
}
if (document.form1.hidRecIDs.value != ""){ // If the hidden field isn't empty
var str = document.form1.hidRecIDs.value; // Store the contents of the hidden field in the variable str
var pos = str.indexOf(ThisID); // Search str to see if this RecID is allready in it.
if (pos == -1) { // If the position returned is -1 it isn't allredy in there,
document.form1.hidRecIDs.value = document.form1.hidRecIDs.value + ", " + (ThisID)
} // so add ", " and this ID to what is already in hidRecIDs
} // to create a list like this *2*, *5*, *8* etc.
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Nannette Thacker -->
<!--
-->
<!-- Begin
function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
var numberfield = objName;
if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
{
numberfield.select();
numberfield.focus();
return false;
}
else
{
return true;
}
}
function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.value.length; i++)
{
ch = checkStr.value.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alertsay = "Please enter only these values \""
alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
// set the minimum and maximum
var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
{
alertsay = "Please enter a value greater than or "
alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
}
// End -->
</script>
<br>
<form name="form1" method="POST" action="<%=MM_editAction%>" >
<table width="500" border="1" cellpadding="0" cellspacing="1" bgcolor="#666699">
<tr>
<td><table width="690" border="1" cellpadding="0" cellspacing="1" bgcolor="#EEEFF2">
<tr>
<td width="52"><strong><font color="#333333" size="1" face="Arial, Helvetica, sans-serif">GameID</font></strong></td>
<td width="16"><strong></strong></td>
<td width="219"><strong><font color="#333333" size="1" face="Arial, Helvetica, sans-serif">Visitor</font></strong></td>
<td width="15"><strong></strong></td>
<td width="177"><strong><font color="#333333" size="1" face="Arial, Helvetica, sans-serif">Home</font></strong></td>
<td width="37"><strong><font color="#333333" size="1" face="Arial, Helvetica, sans-serif">Status</font></strong></td>
<td width="126"><strong><font color="#333333" size="1" face="Arial, Helvetica, sans-serif">Matchup</font></strong></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<% intRecID =(Recordset1.Fields.Item("RecID").Value) ' Store the current RecordID in a variable %>
<tr>
<td nowrap><font size="1" face="Arial, Helvetica, sans-serif"><%= intRecID %><input name="hidRecID<%= intRecID %>" type="hidden" value="<%= intRecID %>" size="5"></font></td>
<td nowrap> </td>
<%
if CStr((Recordset1.Fields.Item("PicksheetStatus").Value)) = "Locked" then
radio_disabled = "disabled="&"true"
else
if CStr((Recordset1.Fields.Item("PStatus").Value)) = "Locked" then
radio_disabled = "disabled="&"true"
else
radio_disabled = ""
end if
end if
%>
<td nowrap><input name="txtNum<%= intRecID %>" type="radio" <%=radio_disabled%> onclick="RecUpdate('<%= intRecID %>')" value="1" <%If (CStr((Recordset1.Fields.Item("RecNum").Value)) = CStr("1")) Then Response.Write("checked") : Response.Write("")%>>
</font> <%=(Recordset1.Fields.Item("VName").Value)%></td>
<td width="15">at</td>
<td nowrap><input name="txtNum<%= intRecID %>" type="Radio" <%=radio_disabled%> id="txtNum<%= intRecID %>" onClick="RecUpdate('<%= intRecID %>')" value="0" size="20" <%If (CStr(Abs((Recordset1.Fields.Item("RecNum").Value))) = CStr("0")) Then Response.Write("checked") : Response.Write("")%>>
<%=(Recordset1.Fields.Item("HName").Value)%> </td>
<%
'
if CStr((Recordset1.Fields.Item("PicksheetStatus").Value)) = "Locked" then
PickSheetStatus = Recordset1.Fields("PicksheetStatus").value
else
if CStr((Recordset1.Fields.Item("PStatus").Value)) = "Locked" then
PickSheetStatus = Recordset1.Fields("PStatus").value
else
PickSheetStatus = "Open"
end if
end if
%>
<td nowrap>
<%=PickSheetStatus%> </td>
<td nowrap><font size="1" face="Arial, Helvetica, sans-serif">
<input name="txtText<%= intRecID %>" type="text" onChange="RecUpdate('<%= intRecID %>')" value="<%=(Recordset1.Fields.Item("RecText").Value)%>" size="20">
</font></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table></td>
</tr>
</table>
<div align="left">
<table width="693" border="1" cellpadding="0" cellspacing="1" bgcolor="#EEEFF2">
<tr>
<td><div align="left"><font size="2" face="Arial, Helvetica, sans-serif">Tie Breaker Total:
<input name="txtTieBreakerTotal" type="text" id="txtTieBreakerTotal" onblur="checkNumeric(this,0,999,'','','');" value="<%=(Recordset2.Fields.Item("TieBreakerTotal").Value)%>" <%=radio_disabled%>>
</font></div></td>
</tr>
<tr>
<td><div align="center"><font size="2" face="Arial, Helvetica, sans-serif">
<input type="submit" name="Submit" value="Submit Picks">
</font></div></td>
</tr>
</table>
<p><br>
<input name="hidRecIDs" type="text" size="40">
<br>
<font size="2" face="Arial, Helvetica, sans-serif"> </font><font size="2" face="Arial, Helvetica, sans-serif">
</font><br>
</p>
<p> </p>
</div>
<input type="hidden" name="MM_update" value="form1">
</form>
<p> </p>
</body>
</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>