I have been workig with Coldfusion for a while now. Where I work there is a need for web pages to extract data from data sources. I have been successful at doing this. Typically I use a form that selects multiple criteria, which when submitted loads a target/action page that displays records that are filtered based on the SQL statement contained on that action page. What I do is to conditionally check if criteria is passed using cfif. And if a field parameter is indeed passed it becomes part of the cfquery. This works out well - especially for reporting.
But now I am seeing more and more a need to accomplish the same process - but on a single cfm page. So the page I seek will have both the form (select) and the recordset results on the same page.
In this exercise I will be caching results od a query and having several queries to further refine what I seek (QOQ). What I am seeking is the best practice to follow, I was thinking that using an iframe on the page would be and adequate solution whereby the query would pass the criteria and its form action would pass the variable(s) to the action page, which would be the source of the iframe. But I am not certain that this is a best proctice. Nor have I had great success at getting the pages to work in concert.
Any advice that you can lend would be appreciated.
I ideally start by reducing the 2-page functionality - of form page and action page - to just one. It goes like this:
<cfset isValidationPassed = false>
<!--- Do validation. Validated form implies isValidationPassed is true --->
<!--- Do action page stuff --->
<cfelseif NOT isDefined("form.someVar") OR NOT isValidationPassed>
<!--- Display the form. --->
<!--- If form had been submitted, inform user which validation failed, and what to correct. Display the form. --->
<cfoutput><form method="post" action="#CGI.SCRIPT_NAME#"></cfoutput>
The idea is then to pile on the complexity, layer by layer.