capodi
Posts: 9
|
| Posted: 08/20/2008, 7:44 PM |
|
Please advise - - SOLVED
I have spent this week reviewing the threads in an effort to construct code that will verify that the update from the Editable Grid (checkbox) has not already taken place by another user for the same record.
My test code (below) has been added and removed from every every event - finally landing in On Validate.
The Issue: When the error is captured and presented - when the reload button is hit, the process doesn't doesn't clear out the checkbox - the checkbox remains checked on the original row representing the old or new entry.
Question: How do I clear out the checkboxes?
Solution: Added a Refresh Button to the form and what's shown in the code...
Forum's help was very much appriciated - thank you all.
Function f_9t_Spares_TFN1_Refresh_OnClick(Sender) 'f_9t_Spares_TFN1_Refresh_OnClick @48-A8FC2450
'Custom Code @49-73254650
' -------------------------
f_9t_Spares_TFN1.Errors.clear
' -------------------------
'End Custom Code
End Function 'Close f_9t_Spares_TFN1_Refresh_OnClick @48-54C34B28
Function f_9t_Spares_TFN1_OnValidate(Sender) 'f_9t_Spares_TFN1_OnValidate @12-D6207DB4
'Custom Code @47-73254650
' -------------------------
Dim i, iRec
Dim SubmittedRows, EmptyRows
Dim IsDeleted, IsEmptyRow, IsDerived
Dim wkTFN, wkReserved
SubmittedRows = f_9t_Spares_TFN1.PageSize + f_9t_Spares_TFN1.EmptyRows
If SubmittedRows > 0 Then
'f_9t_Spares_TFN1.DataSource.CmdExecution = true
For i = 1 To SubmittedRows
IsDeleted = (Len(CCGetRequestParam("_" & CStr(i), Empty)) > 0)
IsEmptyRow = (Len(CCGetRequestParam("TFN_" & CStr(i), Empty)) = 0)
IsDerived = (i < SubmittedRows - EmptyRows + 1)
If (Not IsDeleted) And (Not IsEmptyRow Or IsDerived) Then
wkTFN = CCGetParam("TFN_" & CStr(i), Empty)
wkReserved = CCGetParam("TFN_Reserved_" & CStr(i), Empty)
If wkReserved = 1 Then
iRec = ccdlookup( "count(*)", "[9t Spares TFN]", "TFN = " & wkTFN & " and [TFN Reserved] = YES", DBIntraNet)
If iRec > 0 then
f_9t_Spares_TFN1.Errors.clear
f_9t_Spares_TFN1.Errors.AddError("Entry Previously Reserved. Refresh Screen.")
'f_9t_Spares_TFN1.DataSource.TFN_Reserved.Value = 0
'f_9t_Spares_TFN1.DataSource.CurrentRow = i
'f_9t_Spares_TFN1.DataSource.Update(f_9t_Spares_TFN1.Command)
'Response.Write("<script language=""javascript"">alert('Entry Previously Reserved.')</script>")
'f_9t_Spares_TFN1.DataSource.CmdExecution = false
Exit For
End If
End IF
'response.Write "Row: " & i & " Query: " & iRec & "<BR>"
'response.Write "TFN: " & wkTFN & " Reserved: " & wkReserved & "<BR>"
'response.Write "IsDeleted: " & IsDeleted & " IsEmptyRow: " & IsEmptyRow & "<BR>"
'response.Write "IsDerived: " & IsDerived & "<BR><BR>"
End If
Next
End If
' -------------------------
'End Custom Code
End Function 'Close f_9t_Spares_TFN1_OnValidate @12-54C34B28
[/Code]
Thanks
_________________
Ron
|