This is a basic example of how to create paging in Cold Fusion. If you are using complex SQL queries such as a search with above <cfquery>, you need to make sure that you are passing the parameters to the next/prev hyper links.
Here is an example of a small search action on employee data. First just give an option for user to put in the search criteria.
There are a couple of things about this example before I wind up this article. First, it is creating a WHERE condition in the sql statement if search parameter is passed. Secondly, it creates a link parameter and passes the correct information to the paging hyperlinks. It uses the URLEncodedFormat function to pass arbitrary strings within a URL so the query string passes through the different browser type safely. Cold Fusion automatically decodes URL parameters that are passed to the template while receiving through the URL query string.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |