Question
pagination of a returned recordset
Hi,
(I'm using DW 6.1 and Coldfusion MX with an Access database). I've been
going over this for the past couple of days and I am stumped. I have a form
that collects information used to search on the database:
<FORM name="mp3search" ACTION="mp3test.cfm" METHOD="POST">
<TABLE ALIGN="center" BORDER="1">
<TR bgcolor="#66CCFF" class="memberhead">
<Th width="170"> <div align="left">Speaker's Last Name: </div></Th>
<Th width="243" align="left"> <INPUT TYPE="text" NAME="SpeakerLName"
size="20">
</Th>
</TR><TR class="memberhead">
<Th> <div align="left">Speaking Date</div></Th>
<TD align="left"> <INPUT TYPE="text" NAME="Speak_date" size="10">
</TD>
</TR>
<TR bgcolor="#66CCFF" class="memberhead">
<Th> <div align="left">Title: </div></Th>
<TD> <INPUT TYPE="text" NAME="Title" size="35"> </TD>
</TR>
<TR bgcolor="#66CCFF" class="memberhead">
<Th> <div align="left">Speaking Type: </div></Th>
<TD><select name="Speak_type">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="Sermon">Sermon</OPTION>
<OPTION VALUE="LTT">LTT</OPTION>
<OPTION VALUE="GTT">GTT</OPTION>
<OPTION VALUE="Family Retreat">Family Retreat</OPTION>
<OPTION VALUE="Mens Retreat">Men's Retreat</OPTION>
<OPTION VALUE="Womens Retreat">Family Retreat</OPTION>
<OPTION VALUE="Other">Other</OPTION>
</SELECT> </TD>
</TR>
<TR bgcolor="#66CCFF">
<TD COLSPAN="2" ALIGN="center"> <INPUT TYPE="submit" VALUE="Search">
<INPUT name="Reset" TYPE="reset" VALUE="Clear Form"></TD>
</TR>
</TABLE>
</FORM>
On my action page, my query looks like this:
<cfquery name="rsGetMp3" datasource="Chesapeake">
SELECT *
FROM mp3 WHERE 0=0
</cfquery>
I have recordset pagination code as well. If I select nothing in the form,
all the records show up (which is what I expect), but if I search on, say,
the last name, they still all show up. Further, I have some additional code
that I can put into the query (I repeat the revised query):
<cfquery name="rsMp3Search" datasource="Chesapeake">
SELECT *
FROM mp3 WHERE 0=0
<!--- Search by Last Name --->
<cfif FORM.SpeakerLName IS NOT "">
AND SpeakerLName LIKE '%#FORM.SpeakerLName#%'
</cfif>
<!--- Search by Date --->
<cfif FORM.Speak_date IS NOT "">
AND Speak_date LIKE '%#FORM.Speak_date#%'
</cfif>
<!--- Search by Title --->
<cfif FORM.Title IS NOT "">
AND Title LIKE '%#FORM.Title#%'
</cfif>
<!--- Search by Speaking Type --->
<cfif FORM.Speak_type IS NOT "">
AND Speak_type LIKE '%#FORM.Speak_type#%'
</cfif>
ORDER BY Speak_date DESC
</cfquery>
Running the search again, with just the last name, it works: I get what I
searched for, and only that. BUT now, if there are enough records to create
2 or more pages, when I click on the "next page" link, I get this error:
Element SPEAKERLNAME is undefined in FORM
If I select "show all records" in the query, I get no problem. I don't get
it; I'm at wit's end on this. I'm a dabbler in this so I have much
appreciation for your knowledge and advice.
Thanks.
(I'm using DW 6.1 and Coldfusion MX with an Access database). I've been
going over this for the past couple of days and I am stumped. I have a form
that collects information used to search on the database:
<FORM name="mp3search" ACTION="mp3test.cfm" METHOD="POST">
<TABLE ALIGN="center" BORDER="1">
<TR bgcolor="#66CCFF" class="memberhead">
<Th width="170"> <div align="left">Speaker's Last Name: </div></Th>
<Th width="243" align="left"> <INPUT TYPE="text" NAME="SpeakerLName"
size="20">
</Th>
</TR><TR class="memberhead">
<Th> <div align="left">Speaking Date</div></Th>
<TD align="left"> <INPUT TYPE="text" NAME="Speak_date" size="10">
</TD>
</TR>
<TR bgcolor="#66CCFF" class="memberhead">
<Th> <div align="left">Title: </div></Th>
<TD> <INPUT TYPE="text" NAME="Title" size="35"> </TD>
</TR>
<TR bgcolor="#66CCFF" class="memberhead">
<Th> <div align="left">Speaking Type: </div></Th>
<TD><select name="Speak_type">
<OPTION VALUE=""></OPTION>
<OPTION VALUE="Sermon">Sermon</OPTION>
<OPTION VALUE="LTT">LTT</OPTION>
<OPTION VALUE="GTT">GTT</OPTION>
<OPTION VALUE="Family Retreat">Family Retreat</OPTION>
<OPTION VALUE="Mens Retreat">Men's Retreat</OPTION>
<OPTION VALUE="Womens Retreat">Family Retreat</OPTION>
<OPTION VALUE="Other">Other</OPTION>
</SELECT> </TD>
</TR>
<TR bgcolor="#66CCFF">
<TD COLSPAN="2" ALIGN="center"> <INPUT TYPE="submit" VALUE="Search">
<INPUT name="Reset" TYPE="reset" VALUE="Clear Form"></TD>
</TR>
</TABLE>
</FORM>
On my action page, my query looks like this:
<cfquery name="rsGetMp3" datasource="Chesapeake">
SELECT *
FROM mp3 WHERE 0=0
</cfquery>
I have recordset pagination code as well. If I select nothing in the form,
all the records show up (which is what I expect), but if I search on, say,
the last name, they still all show up. Further, I have some additional code
that I can put into the query (I repeat the revised query):
<cfquery name="rsMp3Search" datasource="Chesapeake">
SELECT *
FROM mp3 WHERE 0=0
<!--- Search by Last Name --->
<cfif FORM.SpeakerLName IS NOT "">
AND SpeakerLName LIKE '%#FORM.SpeakerLName#%'
</cfif>
<!--- Search by Date --->
<cfif FORM.Speak_date IS NOT "">
AND Speak_date LIKE '%#FORM.Speak_date#%'
</cfif>
<!--- Search by Title --->
<cfif FORM.Title IS NOT "">
AND Title LIKE '%#FORM.Title#%'
</cfif>
<!--- Search by Speaking Type --->
<cfif FORM.Speak_type IS NOT "">
AND Speak_type LIKE '%#FORM.Speak_type#%'
</cfif>
ORDER BY Speak_date DESC
</cfquery>
Running the search again, with just the last name, it works: I get what I
searched for, and only that. BUT now, if there are enough records to create
2 or more pages, when I click on the "next page" link, I get this error:
Element SPEAKERLNAME is undefined in FORM
If I select "show all records" in the query, I get no problem. I don't get
it; I'm at wit's end on this. I'm a dabbler in this so I have much
appreciation for your knowledge and advice.
Thanks.
