Reusing Forms

You can now add to as well as update and delete from your Films table. But what if you need to change the form? What if you needed to add a field, or change validation, or update colors? Any changes that need to be made to the Add form also must be made to the Update form.

With all the effort you have gone to in the past few chapters to prevent any duplication of effort, this seems counterproductive.

Indeed it is.

The big difference between an Add and an Update form is whether the fields are prefilled to show current values. Using ColdFusion conditional expressions, you can create a single form that can be used for both adding and updating data.

To do this, all you need is a way to conditionally include the value attribute in

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.