Username:
Password:
Macromedia ColdFusion Tutorials

Review / FORM:SELECT MULTIPLE; Dynamically!

Subtitles of the Movie

To get a little fancy on this, you may want to say at the top of the, at the top - 'please select a village'. So if we came in here, we can actually put that right in here, and we could say the value is 0. You save it, come back, you reload it, please select a village. Please choose a town. Let's look at the source code. There is the hard-coded one that we, here is the hard-coded one that we put in, and then this is the results of the cfoutput. There is our select and our close select in our form. A variation on the select tag is a multiple select tag. If you say multiple here, that means that you can select multiple values. We can also indicate size, we can hard code in the size here 6 because we know that the total is 6, but this is something that we can make a variable as well. But let's just put in 6 so you could see what the results are, because we know that there are 5 of these and then there is this one here. So let's save this, come back out here, reload it and this is a multiple select list. Because you can select, if I click for instance Turners falls and then hold down my control key and hit Millers falls, and hold down the control key again and hit Montague city, multiple selections. If I were to submit this in a form, then I would get a comma-separated list. Meaning that in the receiving form, there would be a variable called form.village_ID and its values will be equal to whatever the ID numbers are here. See, because we are saying that the value is the village ID number which is, you know or the value is zero, if we would have chosen that one. So in this case, form.village_ID would be equal to on the receiving template page 1,3,5. And that's very useful. Let's make this a variable, variable size. There is a value, a variable called record count [.recordcount], record. Whatever the query name is, .recordcount will return a number, a number of records that was returned from the query. In this case, its value is 5. But we want to make it, we want to make the size 6 for this selection list, so we can actually say here plus 1 [+1]. Let's save it and see if we don't get any errors. What if I put the parentheses out here, get rid of the quotes. Save it and run it, same thing. Let's view the source code. Coding on the fly, that's the only way to learn. That's why - we did not put cfoutput around this. Let's put a cfoutput around this one here and then we actually have to put this inside that, and we can probably do away with the parentheses. So now this should work. So this will return a 5 and the plus one. Maybe we should put this in a parentheses. Let's see if this works. Save it, still not. What does the source say? 5+1. My guess is we have to put the whole thing inside of a Cold Fusion, Hmm - "No Cold Fusion function named Sum". Hmm - "No Cold Fusion function named Sum".

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