| By Ben Forta | Article Rating: |
|
| April 3, 2000 12:00 AM EDT | Reads: |
38,681 |
Using Forms
In the previous two articles (CFDJ, Vol. 2, issues 2 and 3) on "ColdFusion Basics," you learned how to create ColdFusion templates that dynamically display data retrieved from ODBC data sources. The A2Z Employees table has just 10 rows, so the data fits easily within a Web browser window.
What do you do if you have hundreds or thousands of rows? Displaying all that data in one long list is impractical. Scrolling through lists of names to find the one you want just doesn't work well. The solution is to enable users to search for names by specifying what they are looking for. You can allow them to enter a first name, a last name, or part of a name, and then you can display only the employee records that meet the search criteria.
To accomplish this solution, you need to do two things. First, you need to create your search form using the HTML form tags. Second, you need to create a template that builds SQL SELECT statements dynamically based on the data collected and submitted by the form. Creating Forms
Before you can create a search form, you need to learn how ColdFusion interacts with HTML forms. Listing 1 contains the code for a sample form that prompts for a first and last name. Create this template and save it in the C:\A2Z\SCRIPTS\12 directory as FORM1.CFM.
In your browser, type http://your-server.com/a2z/12/FORMS1.cfm to display the form as shown in Figure 1.
This form is simple, with just two data entry fields and a submit button, but it clearly demonstrates how forms are used to submit data to ColdFusion. Using HTML Form Tags
You create HTML forms by using the
Published April 3, 2000 Reads 38,681
Copyright © 2000 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Ben Forta
Ben Forta is Adobe's Senior Technical Evangelist. In that capacity he spends a considerable amount of time talking and writing about Adobe products (with an emphasis on ColdFusion and Flex), and providing feedback to help shape the future direction of the products. By the way, if you are not yet a ColdFusion user, you should be. It is an incredible product, and is truly deserving of all the praise it has been receiving. In a prior life he was a ColdFusion customer (he wrote one of the first large high visibility web sites using the product) and was so impressed he ended up working for the company that created it (Allaire). Ben is also the author of books on ColdFusion, SQL, Windows 2000, JSP, WAP, Regular Expressions, and more. Before joining Adobe (well, Allaire actually, and then Macromedia and Allaire merged, and then Adobe bought Macromedia) he helped found a company called Car.com which provides automotive services (buy a car, sell a car, etc) over the Web. Car.com (including Stoneage) is one of the largest automotive web sites out there, was written entirely in ColdFusion, and is now owned by Auto-By-Tel.
- Cloud Expo New York Call for Papers to Expire January 15, 2010
- My Three iPhone Predictions For 2010
- Adobe Fiddles with its Web Apps
- Adaptivity “Platinum Plus Sponsor” of Cloud Expo
- UPDATE: Adobe & IE Implicated as China’s Spy Holes
- Adobe Discusses Cloud Computing
- Microsoft WebsiteSpark: Get New Business Leads to Grow Your Business
- Adobe Flash on the Road to Nowhere
- Streaming Media in the Cloud by Amazon and Adobe
- Apple and Emotional Discussions Around Adobe Flash Player
- Jobs Has a Few Words for Google & Adobe & They Ain’t Pretty: Reports
- Built4Flash Launched by Farata Systems
- Cloud Expo New York Call for Papers to Expire January 15, 2010
- My Three iPhone Predictions For 2010
- Adobe Fiddles with its Web Apps
- Adobe Flex Developer Earns $100K in New York City
- Adaptivity “Platinum Plus Sponsor” of Cloud Expo
- Adobe Betas Target RIAs and Cloud Computing
- UPDATE: Adobe & IE Implicated as China’s Spy Holes
- Adobe Discusses Cloud Computing
- Microsoft WebsiteSpark: Get New Business Leads to Grow Your Business
- Adobe Flash on the Road to Nowhere
- Adobe Discusses Cloud Computing and Government
- Streaming Media in the Cloud by Amazon and Adobe
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF






















