JavaScript
  Home arrow JavaScript arrow A Basic Approach to Server-side Data Valid...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

A Basic Approach to Server-side Data Validation with AJAX
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2006-07-11

    Table of Contents:
  • A Basic Approach to Server-side Data Validation with AJAX
  • A picture is worth a thousand words: defining the look and feel of the application
  • Building a basic sample form: defining the front-end of the AJAX-based form checking system
  • Spicing up the sample form: defining a few CSS declarations
  • Putting the pieces together: listing the full (X)HTML markup and CSS styles of the AJAX application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    A Basic Approach to Server-side Data Validation with AJAX


    (Page 1 of 5 )

    Would you like to learn how to validate user-supplied data using JavaScript, but without the risks? This article will show you how to handle it in a way that takes advantage of JavaScript's pluses, but adds a level of safety, thanks to AJAX. It is the first of three parts.
    A downloadable file for this article is available here.

    Validating user-supplied data has been for years a highly discussed topic within the huge area of Web development. What really makes this subject an interesting thing is its significant grade of evolution during the last few years, being specifically empowered by the capacities of the different server-side scripting languages.

    While validating online forms with JavaScript is a feature that can still be found on numerous websites, the truth is that this approach delivers extremely unsafe and unreliable results, particularly if the data being submitted affects some sensitive areas of those sites. Of course what I just said isn't breaking news to you, and quite probably you've been using your own server-side validation routines for a long time; as a result, JavaScript doesn't fit into your scheme any longer.

    Nevertheless, one of the most appreciated advantages of using JavaScript-based validation rests mainly on its quick response, which makes it very suitable for notifying the user as to what data is wrong, as soon as he/she has finished typing a value on a specific form field. Unfortunately, as with everything in life, this responsiveness comes at a cost, and the drawback of this approach consists of its complete dependency on using scripting-enabled browsers, in order to perform the validation on the data in question.

    But it's not all bad news when it comes to using JavaScript for checking user input. With the help of AJAX and a handy group of server-side validation routines, it's possible to have a relatively fast system, which can inform the user via JavaScript when invalid data was entered on an online form, while the real validation is performed on the server, with the scripting language of your choice.

    Aside from the advantages that I mentioned before, this validation mechanism can be developed bearing in mind specific conditions where JavaScript has been disabled by the client, while still maintaining its full validation capabilities on the server. Indeed, this approach can be quite useful for constructing richer Web applications, and that's precisely what I'm going to do in the next few lines: build an AJAX-driven form validation application, which will use PHP for validating data on the server.

    Of course, due to the versatility of the application that I plan to build, you can use your favorite server-side scripting language instead of PHP, and keep the same functionality. Okay, I'll stop wasting your precious time and go straight to showing you how to create this little AJAX-based application. Let's get going!

    More JavaScript Articles
    More By Alejandro Gervasio


       · This first part of the series introduces a comprehensive approach on how to validate...
       · Hi.I congratulate you on the good tutorialbut I'm wondering what happens if...
       · Hello Wisher,Thank you for commenting on my AJAX article. Concerning your...
     

    JAVASCRIPT ARTICLES

    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps
    - Adding Zoom Controls to Yahoo! Maps
    - Working with Yahoo! Maps
    - Building Image Zooming Controls with the DOM...
    - Working with Multiple Graphics for a Zoom Ap...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway