|
Mailing Lists
|
Home / Groups / HE3
dynamic SQL & next-N nav probhi ppl, I've been having probs getting the next-n nav to work. everything works when i do the first search (its a search page that gets its values from a post). But when I click next 20 i get: "Element NAME is undefined in FORM". My guess is that the values given in the SQL query are not being re-used when i loop...the coldfusion documentation is not great but from what i understood, dynamic SQL and next-n don't mix. can any1 help me? heres the code: --------------------------------- <!---i define startrow and maxrows ---> <cfparam name = "StartRow" default = "1"> <CFPARAM NAME="DisplayRows" DEFAULT="20"> <!-- sQL--> <cfquery name="Search_DPD" datasource="DPD" <!--ive been trying to cache the results.doesnt seem to work though--> CACHEDWITHIN="#CreateTimeSpan(0,0,15,0)#"> Select ID, Name, street, City, category from DPD where 0=0 <cfif #form.name# is not ""> and DPD.name like '%#form.name#%' </cfif> <cfif #form.street# is not ""> and DPD.street like '%#form.street#%' </cfif> <cfif #form.zip# is not "Any"> and DPD.zip like '%#form.zip#%' </cfif> <cfif #form.city# is not ""> and DPD.city like '%#form.city#%' </cfif> <cfif #form.category# is not "Any"> and DPD.category like '%#form.category#%' </cfif> order by name </cfquery> <!---variable to hold record number of last record to output on current page. ---> <CFSET ToRow = StartRow + (DisplayRows - 1)> <CFIF ToRow GT Search_DPD.RecordCount> <CFSET ToRow = Search_DPD.RecordCount> </CFIF> <!--start+end of head, start of body--> <!--headers of the results--> <!--output--> </table> <!--- update the values for the next and previous rows to be returned ---> <CFSET Next = StartRow + DisplayRows> <CFSET Previous = StartRow - DisplayRows> <!--- NEXT N NAV---> <CFOUTPUT> <!--- prev records link ---> <CFIF Previous GTE 1> <A HREF="searchresult.cfm?StartRow=#Previous#"> <B>Previous #DisplayRows# Records</B></A> <CFELSE> Previous Records </CFIF> <B>|</B> <!--- next records link ---> <CFIF Next LTE Search_DPD.RecordCount> <A HREF="searchresult.cfm?StartRow=#Next#"> <B>Next <CFIF (Search_DPD.RecordCount - Next) LT DisplayRows> #Evaluate((Search_DPD.RecordCount - Next)+1)# <CFELSE> #DisplayRows# </CFIF> Records</B></A> <CFELSE> Next Records </CFIF> </CFOUTPUT> |
February 12, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||