Learning jQuery: Better Interaction Design and Web Development with Simple JavaScript Techniques
www.PACKTPUB.com  FREE ONLINE EDITION: Read full chapters online, download free samples from the book and more...
Book Contents Index > Chapter 8

Preface

1: Getting Started
2: Selectors—How to Get Anything You Want
3: Events—How to Pull the Trigger
4: Effects—How to Add Flair to Your Actions
5: DOM Manipulation—How to Change Your Page on Command
6: AJAX—How to Make Your Site Buzzword-Compliant
7: Table Manipulation Free Chapter
8:
Forms with Function  
9: Shufflers and Rotators
10:
Plug-ins

Appendix A: Online Resources

Appendix B: Development Tools
Appendix C: JavaScript Closures

Index

Latest Updates

Free Chapter:
Chapter 7: Table Manipulation [1.31 MB PDF]

Contact us

Chapter 8: Forms with Function

I'm shoutin'
We're waiting for a reply
    —Devo, "Shout"

Nearly every website that requires feedback from the user will employ a form in one capacity or another. Throughout the life of the Internet, forms have played the role of pack mule, carrying information from the end user back to the website's publisher—dependably, reliably, but with very little grace or style. Perhaps this lack of flair was caused by the repetitious, arduous journey to the server and back; or perhaps it had something to do with the intransigent elements the form had to work with and their unwillingness to follow the latest fashion. Whatever the reason, it wasn't until recently, with the resurgence of client-side scripting, that forms found new vigor, purpose, and style. In this chapter, we will look at ways in which we can breathe new life into forms. We'll enhance their style, create validation routines for them, use them for calculations, and send their results to the server while nobody is watching.

Chapter 8: Forms with Function

  • Progressively Enhanced Form Styling
    • The Legend
    • Required Field Messages
      • A Regular Expression Digression
      • Inserting the Field-Message Legend
    • Conditionally Displayed Fields
  • Form Validation
    • Immediate Feedback
      • Required Fields
      • Required Formats
    • A Final Check
  • Checkbox Manipulation
  • The Finished Code
  • Placeholder Text for Fields
  • AJAX Auto-Completion
    • On the Server
    • In the Browser
    • Populating the Search Field
    • Keyboard Navigation
      • Handling the Arrow Keys
      • Inserting Suggestions in the Field
      • Removing the Suggestion List
    • Auto-Completion versus Live Search
  • The Finished Code
  • Input Masking
    • Shopping Cart Table Structure
    • Rejecting Non-numeric Input
  • Numeric Calculations
    • Parsing and Formatting Currency
    • Dealing with Decimal Places
    • Other Calculations
      • Rounding Values
      • Finishing Touches
  • Deleting Items
  • Editing Shipping Information
  • The Finished Code
  • Summary

 

   

 

Paperback 380 pages
Released: July 2007
ISBN: 1847192505
ISBN 13:
978-1-847192-50-9

     

 




View the book details
on PacktPub.com

 


 
  This website is owned and maintained by Packt Publishing Ltd, 2007. All rights reserved. Terms and Conditions