Lesson 7. Building a Tour Price Calculator

One of the most significant benefits of dynamic Web sites is that they are capable of including self-service applications. Self-service applications are a win-win situation for businesses and customers alike. Customers don't have to go to the trouble of calling a number, pressing a sequence of numbers ("please press 3, now"), and sitting interminably on hold ("your call is important to us"), only to learn that office hours ended three hours ago. Businesses decrease incoming calls, which decreases long-distance phone charges and hours, and yet can still serve customers 24 hours, 7 days a week.

In this lesson, you will build a tour price calculator, which enables users to obtain an estimate for the cost of a tour based on the number of adults and children going on the tour. You'll use ASP or ColdFusion to multiply the tour price by the number of adults and children to come up with the estimate. This estimate will be output using correctly formatted currency.

Your application both enables users to build customized estimates and ensures that they enter the correct information, displaying an error message inline if they do not.

graphics/07fig01.gif

The calculator won't have full functionality until the end of Lesson 9, however, because part of it uses price amounts drawn dynamically from a database. But in this lesson, you'll build the majority of the application and temporarily hard-code the price values while you nail the functionality.

But that's not all you'll do. You'll also extend your skills with form validation, this time writing custom ASP or ColdFusion code to handle form validation on the server side, rather than the client side, as in Lesson 6. You'll create a custom cascading style sheet (CSS) class, and see how to use ASP or ColdFusion to create a region of the page that displays conditionally: If the user does not fill in the form, an error message, written inline in HTML, appears that was hidden before.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Create a simple self-service application

  • Collect and manipulate form data

  • Display data, using a built-in function to format it as currency

  • Deploy server-side form validation

  • Create a custom CSS class

  • Use a conditional HTML region

APPROXIMATE TIME

This lesson takes approximately two hours to complete.

LESSON FILES

Starting Files:

Lesson07/Start/newland/generic_template.asp

Lesson07/Start/newland/contact.asp

Lesson07/Start/newland/newland.css

Completed Files:

Lesson07/Complete/newland/tourprice.asp

Lesson07/Complete/newland/tourprice_processor.asp

Lesson07/Complete/newland/newland.css