ColdFusion has many different scopes for variables. Some of the major ones include Application, session, client,
variables, request, cookie, FORM, URL, and there are others.
When setting and reading variables, you should always prefix the variable name with the appropriate scope.
For example, if you submit a form with a 'name' field, the action page will have access to that variable
as either 'name' or 'FORM.name'.
It isn't necessary to supply the 'FORM' part of the variable name, but there are three reasons you should.
1. It is a best practice - you should just do it!
2. It is easier to read - Requirements tend to grow larger and more complex, and your pages will need additional code to handle the increased complexity. If your variables aren't scoped, you can lose site of where the variable comes form.
3. The page will run faster - If all variables are scoped, the CF server knows where to look for the variable when reading them. If your variables don't have a scope, the server has to look around in memory until it finds it.
These rules apply to all scopes, not just FORM variables.
All ColdFusion Tutorials By Author: Nathan Miller
Easy automatic debugging
Extend the use of the new tag in CF5
to display any and all ColdFusion and CGI variables. Author:Nathan Miller Views: 22,405 Posted Date: Saturday, December 21, 2002
Scope your variables
Increase performace and readability by always scoping your variables Author:Nathan Miller Views: 33,141 Posted Date: Monday, May 19, 2003
Add a newsfeed to your site
Use the Moreover news service to add a news
feed to your site using cfhttp and wddx in 5 minutes! Author:Nathan Miller Views: 32,207 Posted Date: Saturday, July 26, 2003
Advanced Server-Side FORM Validation
An advanced set of customizable tags for validating FORM values on the Server-side using User-Defined Functions Author:Nathan Miller Views: 33,009 Posted Date: Monday, December 15, 2003
Dynamically add and remove a 'please wait' message to your complex pages
You can use a combination of and javascript to show a message on the screen
while processing a large data set (or any other long-running task), and then remove the message when the task is complete. Author:Nathan Miller Views: 45,352 Posted Date: Tuesday, January 13, 2004
DHTML Tabs (Part 1 of 2)
Visual tab control generator - Creates an interface that loads all the data in each tab in a single page request. This allows the users to click on each tab in the interface and instantly see the data on that tab without waiting for it to load. Author:Nathan Miller Views: 24,021 Posted Date: Wednesday, October 26, 2005
Coldfusion Master Pages
Use ASP.NET-style master pages to replace your header/footer files for web page layout Author:Nathan Miller Views: 19,478 Posted Date: Wednesday, August 30, 2006
ColdFusion Content Injection
Inject customized content into predefined messages by adding specially formatted placeholders in the message. Author:Nathan Miller Views: 19,309 Posted Date: Wednesday, March 28, 2007