1) URL.RecordID pulls data from query on entering form.
2) Records displayed.
3) User enters search criteria to display records from initial query routine.
4) User can clear search box and return original records displayed from initial URL.RecordID.
Problem: 1 & 2 works however when next and/or back button selected all the records in the table are displayed instead of the original records selected by the URL.RecordID.
Once the user enters search criteria I get an error because there are two tables: tblCaseNames and tblPlaintiffData. The CaseID in tblCaseNames is matched to the URL.RecordID then the CaseID in tblCaseNames is matched to the CaseID in tblPlaintiffData.
Appears that it bombs when it goes to matchup the CaseID with the CaseID pulled in from the search routine.
Having a problem using SESSION to capture what the user entered into the search box (also trying to store the case id for that record) so that when the search box is cleared it knows what case id was originally passed when the form was initially entered using the URL.RecordID.
Also the next and back buttons pulls up all the records not what was displayed using the search filter.
I think I have made this too complicated but can't believe that others have not done what I'm trying to do.
So now I'm asking the experts for their help. Here's the code.
<cfparam name="URL.CaseID" default="1">
<cfset CurrentPage=GetFileFromPat
h(GetTempl
atePath())
>
<cfparam name="URL.RecordID" default="">
<cfparam name="URL.chkSample" default="">
<cfparam name="PageNum_recordset1" default="1">
<CFPARAM name="url.sort" default="PlaintiffName">
<!--- If user is submitting the "filter" form, --->
<!--- we'll make their submission be the filter for the rest of session --->
<CFIF IsDefined("FORM.LookupData
.UserData"
)>
<CFSET SESSION.tblPlaintiffData.U
serFilter = FORM.LookupData.UserData>
<CFSET SESSION.tblPlaintiffData.G
etID = FORM.LookupData.LookupCase
ID>
<CFELSE>
<CFSET SESSION.tblPlaintiffData.U
serFilter = "">
<CFSET SESSION.tblPlaintiffData.G
etID = #URL.RecordID#>
</CFIF>
<CFIF URL.RecordID is "">
URL.RecordID = SESSION.tblPlaintiffData.G
etID
</CFIF>
<cfquery name="Recordset2" datasource="TexasWebAppPc"
>
SELECT *
FROM dbo.tblCaseNames
<CFIF IsDefined('FORM.LookupData
.UserData'
)>
WHERE CaseID = Form.LookupData.LookupCase
ID
<CFELSE>
WHERE CaseID = #URL.RecordID#
</CFIF>
</cfquery>
<!--- If this is the first time in the form get the URL.RecordID --->
<!--- Retrieve case records from database --->
<cfquery name="Recordset1" datasource="TexasWebAppPc"
>
SELECT * FROM tblPlaintiffData WHERE
<CFIF SESSION.tblPlaintiffData.U
serFilter IS NOT "">
0=0
AND (PlaintiffName LIKE '%#SESSION.tblPlaintiffDat
a.UserFilt
er#%')
<CFELSE>
CaseID = #URL.RecordID#
</CFIF>
ORDER BY #url.sort#
</cfquery>
<cfquery name="GetTotalRecords" datasource="TexasWebAppPc"
>
SELECT Count(*) as TotalRecords
FROM tblPlaintiffData
</cfquery>
<!--- Number of rows to display per Next/Back page --->
<CFSET RowsPerPage = 10>
<!--- What row to start at? Assume first by default --->
<CFPARAM NAME="URL.StartRow" DEFAULT="1" TYPE="numeric">
<!--- Allow for show all parameter in the URL --->
<CFPARAM NAME="URL.ShowAll" TYPE="boolean" DEFAULT="No">
<!--- We know the total number of rows from query --->
<CFSET TotalRows = recordset1.recordcount>
<!---
<!--- Show all on page if showall passed in url --->
<CFIF URL.ShowAll>
<CFSET RowsPerPage = TotalRows>
</CFIF>
--->
<!--- Last row is 10 rows past the starting row, or --->
<!--- total number of query rows, whichever is less --->
<CFSET EndRow = Min(URL.StartRow + RowsPerPage - 1, TotalRows)>
<!--- Next button goes to 1 past current end row --->
<CFSET StartRowNext = EndRow + 1>
<!--- Back button goes back N rows from start row --->
<CFSET StartRowBack = URL.StartRow - RowsPerPage>
<html>
<head>
<title>Form1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL=stylesheet HREF="mystyles.css" TYPE="text/css">
<script language = "Javascript">
<!--
/**
* DHTML check all/clear all links script. Courtesy of SmartWebby.com (
http://www.smartwebby.com/dhtml/)
*/
var form='frmSample' //Give the form name here
function SetChecked(val,chkName) {
dml=document.forms[form];
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if (dml.elements[i].name==chk
Name) {
dml.elements[i].checked=va
l;
}
}
}
function ValidateForm(dml,chkName){
len = dml.elements.length;
var i=0;
for( i=0 ; i<len ; i++) {
if ((dml.elements[i].name==ch
kName) && (dml.elements[i].checked==
1)) return true
}
alert("Please select at least one record to be deleted")
return false;
}
// -->
</script>
</head>
<body topmargin="0">
<h2 align="center">Texas Echo Tracking Database Plaintiff Lookup</h2>
<!--- Simple style sheet for formatting --->
<STYLE>
TH {font-family:sans-serif;fo
nt-size:sm
aller;
background:navy;color:whit
e}
TH {font-family:sans-serif;fo
nt-size:sm
aller}
TD.DataA {background:silver;color:b
lack}
TD.DataB {background:lightgrey;colo
r:black}
</STYLE>
<CFFORM name=LookupData action="#CGI.SCRIPT_NAME#"
method="post">
<!--- Filter string --->
<B>  
; &nb
sp; &
nbsp; 
; <fon
t size="2">Filter by Plaintiff Name:</font></B>
<cfinput
type="text"
name="UserData"
value="#SESSION.tblPlainti
ffData.Use
rFilter#"
size="30">
<cfinput
type="text"
name="LookupCaseID"
value="#SESSION.tblPlainti
ffData.Get
ID#">
<!--- Submit button to activate/change/clear filter --->
<input
type="submit"
value="Apply">
</CFFORM>
<cfform name="frmSample" method="post" action="NewDeleteRecord.cf
m?recordid
=#recordse
t1.plainti
ffid#" onSubmit="return ValidateForm(this,'chkSamp
le')">
<div align="center">
<p>  
; &nb
sp; &
nbsp; 
; &nb
sp; &
nbsp; 
; &nb
sp;
<input type='submit' name="" value='Delete Records'>
<a href="javascript:SetChecke
d(1,'chkSa
mple')" class="brownsubtitle"><fon
t face="Times New Roman, Times, serif"
size="1"> Check
All</font></a>
<a href="javascript:SetChecke
d(0,'chkSa
mple')" class="brownsubtitle">
<font face="Times New Roman, Times, serif" size="1"> Clear
All</font></a>
<!--- your dynamic table contents comes here (change the name chkSample everywhere if you want to)--->
<table width="83%" height="104" border="6" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4">
<!--- Message about which rows are being displayed--->
<cfoutput>
<font size="1"> Displ
aying <B>#URL.StartRow#</B> to <B>#EndRow#</B>
of <B>#TotalRows#</B> Records<BR></font>
</cfoutput>
</TD>
<td colspan="5"> &n
bsp;
<!--- Provide Next/Back links --->
<CFINCLUDE TEMPLATE=NextNIncludeBackN
ext.cfm>
</TD>
</TR>
<tr>
<th width="22%" bgcolor="#FFB895"><u>Case Name/Case ID</u></th>
<th width="33%" bgcolor="#FFB895"><u>Plain
tiff Name</u></th>
<th width="12%" bgcolor="#FFB895"><u>Plain
tiff ID/CaseID</u></th>
<th width="18%" bgcolor="#FFB895"><div align="center"><u>Status</
u></div></
th>
<th width="11%" bgcolor="#FFB895"><div align="center"><u>Challeng
ed By</u></font></div></th>
<th width="11%" bgcolor="#FFB895">Delete Record</th>
<td></td>
<td></td>
</tr>
<tr>
<!--- For each query row that should be shown now --->
<CFLOOP query="recordset1" StartRow="#URL.STartRow#" EndRow="#EndRow#">
<!--- Use class "DataA" or "DataB" for alternate rows --->
<CFSET Class = IIF(recordset1.CurrentRow MOD 2 EQ 0, "'DataA'", "'DataB'")>
<cfoutput>
<td bgcolor="##FFFFFF"><font size="1"> #reco
rdset2.Cas
eName#&nbs
p; &n
bsp;
&nbs
p; #r
ecordset2.
CaseID#</f
ont></td>
</cfoutput>
<CFOUTPUT>
<td bgcolor="##FFFFFF"><a href="UpdatePlaintiffData.
cfm?record
ID=#record
set1.Plain
tiffID#"><
font size="1"> #recordset1
.Plaintiff
Name#</fon
t></a></td
>
<td bgcolor="##FFFFFF"><div align="center"><font size="1">#recordset1.Plain
tiffID#&nb
sp;/
#recordset
1.caseid#<
/font></di
v>
</td>
<td bgcolor="##FFFFFF"><div align="center"><font size="1">#recordset1.Statu
s#</font><
/div></td>
<td width="11%" bgcolor="##FFFFFF"><div align="center"><font size="1">#DateFormat("#rec
ordset1.Ch
allengedBy
#",
"mm/dd/yyyy")#</font></div
>
</td>
<td align="center"><input type="checkbox" name="chkSample" value="#PlaintiffID#">
</td>
</tr>
</cfoutput>
</CFLOOP>
<!--- Row at bottom of table, after rows of data --->
<!--- <tr>
<td width="100" align="right">
<!--- Provide Next/Back links --->
<CFINCLUDE TEMPLATE=NextNIncludeBackN
ext.cfm>
</td>
</TR> --->
</table>
<table width="51%" align="center">
<tr>
<td width="30%"><div align="left"> <strong
><a href="CaseMasterDetail.cfm
"> Ca
se Name Lookup</a></strong></div>
</td>
<td width="45%"><div align="left"> <strong
><a href="Index2.cfm"> Ma
in Menu</a></strong></div></t
d>
<td width="12%"> </td>
<td width="13%"> </td>
</tr>
</table>
</cfform>
</body>
</html>