Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 4. Error Handling inForms > Project III: Letting the User Know What's W...

Project III: Letting the User Know What's Wrong

This final piece of code is nothing groundbreaking—we will be using methods that we covered earlier in the chapter. If the world were a perfect place, then the user would have filled out the form properly. However, this isn't always the case, so now that we have gone through and made the necessary checks for missing or erroneous data, we need to pass on what we have found to the user. We will use a simple if statement to accomplish this.

// Letting the user know what was missed

if ((requiredFieldsErrorMessage) ||
    (whatTheyWantErrorMessage) || (emailErrorMessage) ||
    (areaCodeErrorMessage) || (zipCodeErrorMessage))
{
     …
}
else
{
     …
}
}
// Stop hiding the code here -->
</SCRIPT>


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial