Home
Username:
Password:
Adobe ColdFusion 8 Tutorials

Search Criteria / Search Action




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

In this movie,, we're going to take a look at the sumaSearchActionForm and this is a completely separate page from the sumaSearchForm in case you have seen that particular file, right next door here. This SearchAction contains the exact same form that's on here, but it also contains the action information on the same page, so you don't have to go over and look at the sumaSearchForm necessarily. So, here is our search form and action page and you can see the top's kind of the search and the bottom is the results. So let's take a look at each one. What I'll do is walk through the process as it is now so you can see what it'll look like for the user. So I'm going to select All Countries and All Dive Types, no Live-aboard and when I hit search you can see it pulls these tours up. Now it'd be good to have a link to go back to search for another tour - one of those little AddOn features that should be done for usability. I can also search for a particular country. I'll do the British Virgin Islands and you can see it pulls up that information. Now what if I do the Virgin Islands and I want Soft Coral Diving. You could see this is when my message comes out referring them to either giving us a call or using the Suggestion form, so those are kind of the three little pieces that can occur on this form. So how does all of that occur? Up at the top we have our query to populate our drop-down menus which we looked at in the Form movie, then we have our basic form up at the top here. So, what's happened is, we're going to test to see if the Submit button has been clicked by the user. If it has not been clicked then it's going to show our form up here. If it has been clicked our else statement will run, so let's take a look at that section. Now what I'm doing is setting a cfparam to make sure that these variables will exist so we don't get any of those types of errors where ColdFusion is trying to work with a variable and it doesn't exist. Here is our query, this is our QSEARCH Tour. I plugged in all of the columns in both tables where we have our Table Join and the reason for that is just to make it easier - it's less code for you to have to look at, so we can kind of focus on this section. Now this is a Table Join because it is two tables being put together so I don't need a Dummy WHERE Clause in order to use my AND Statement because I already have a valid WHERE Clause that's necessary, so you only need the Dummy WHERE Clause if you want to run these multiple ANDs and you don't have a WHERE Clause already. So we're going to test and make sure that the Country field is defined and it's not equal to All. Why do we care about All? Well, we only want to search for a single country if the user chose a single country, otherwise, if they chose our Static Option the value of our static option is All as you can see for both country and dive types. So we can use that to test for it and if it's not all of them then we will plug in, from the from, the exact one the user chose. Our live-aboard is basically done the same way but we don't need this last section. It's either checked or not, so if it's defined we'll test the value of either zero or negative one, we plugged it into the database, not as true-false, but as minus 1 and zero representing true and false - that takes up less space in the database. Now, if our query returns a record count then we won't be using this section. It would show our search results inside a table. If there are no records returned from our query then it will give the user a message letting them know to give us a call or offer a suggestion on our Suggestion form. If there are results, it populates them into a table, which we already saw. So, I would suggest you take some time to look over the code within this page, both the Form and the Action section. Most websites do require a multiple search form so it is a good thing to get accustomed to and that's why even though this is a basic course, I wanted to make sure that I included this for you. So, that is creating a Multiple Search Form for a website in ColdFusion.

Tutorial Information

Course: Adobe ColdFusion 8
Author: Candyce Mairs
SKU: 34093
ISBN: 1-936334-05-4
Release Date: 2010-02-26
Duration: 8 hrs / 112 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available