Creating Dynamic Search Screens

There is one final improvement to be made to your application. The list of ratings used in the search form has been hard-coded (refer to Listing 12.17). Remember that you’re creating data-driven applications. Everything in your application should be data-driven. You don’t want to have to manually enter data, not even in list boxes. Rather, you want the list box to be driven by the data in the FilmsRatings table. This way, you can acquire changes automatically when ratings are added or when a rating name changes.

Listing 12.19 is identical to Listing 12.17, with the exception of the addition of a new <cfquery> and a <cfoutput> block to process its contents.

Listing 12.19. search4.cfm—Data-Driven Forms
<!--- Name: ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.