Username:
Password:
Macromedia ColdFusion Tutorials

Review / Quick Review of FORM:SELECT

Subtitles of the Movie

Before we get started in actually creating any files, let's get some basic building blocks down and what we are going to be using later. One of them is in creating dynamic drop down lists in forms from the contents of a database. We are using a Microsoft Access database, and you'll see that explained at the beginning of the next chapter when we do the creating business directory. We use it in several places. So let's take a look at the code that creates this simple little form, because this portion right here is actually a form. And this is very, very simple - this is all the content in the page. So here is the form tag and the closing form tag. So, we will sort of separate that out. I type in the text, 'please choose a town' and then we have what's called a select tag or a select input, form input. Select actually creates a drop down; this is what is a select. So, it's what select is called, and there are variations on it, and I will show you that in a minute. But we are just going to use the basics for right now. And then in the select whose name is village ID, because we are passing the value of the village ID the number that matches in the database, we have 3 options right now - town A, B and C whose values are 1, 2 and 3. This is all for a form that's going to be passed to a receiving Cold Fusion page. Same as in, this is basic HTML - there are no Cold Fusion tags in this entire thing except for up here and down here. But in the form itself, this is all basic HTML, and one which I hope you know. Hopefully, you are just skipping right past this, because you already know it. But if you don't, it's good to watch. The value is set to a number, because in our database, the way that our database is going to be working, we are linking. It's a relational database, and for each business, they can be in one of the towns. We don't want to actually put the full town name in the database, because there's only 5 towns in our database, and several hundred businesses and it would be an awful waste to have town A, town A, town A written over and over and over again in the database. Normalizing the database requires that you have anything that is repetitious written once in a separate table, and then you refer to it or you relate to it with a number. So for all the businesses that are in town A, we simply put a 1 in that column, in the town column. And then we tell the database that that 1 relates to another table that has values 1, 2, or 3. So that's how we are setting this up. HTML and Cold Fusion is just a patch of a whole lot of things that all work together, and if you don't understand what something is when you look at it the first time, it may be because you have to look a little bit farther. What is a device here? These are all just devices. When this gets passed to the receiving form, there will be a variable named village ID with a value of 1, 2 or 3, and in Cold Fusion parlance it will actually be url.villageid or form.villageid actually. Because this is being passed from a form. But if we modify this, I could say Towny C, if I save it and we look at the page and reload it, then you see now that the third one is indeed Towny C. So let's go back and in the next movie, we are going to show how to have these names, these values here pulled out of the Access database using Cold Fusion, and the Cold Fusion query command and the Cold Fusion output command. g Cold Fusion, and the Cold Fusion query command and the Cold Fusion output command.

Tutorial Information

Course: Macromedia ColdFusion
Author: Mike Muller
SKU: 33287
ISBN: 1930519656
Release Date: 2001-12-19
Duration: 8 hrs / 86 lessons
Work Files: Yes
Captions: For Online University members only
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available