JavaScript
  Home arrow JavaScript arrow Page 3 - 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  
Moblin 
JMSL Numerical Library 
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


    A Basic Approach to Server-side Data Validation with AJAX - Building a basic sample form: defining the front-end of the AJAX-based form checking system


    (Page 3 of 5 )

    In this particular case, defining the front-end of this AJAX-driven application for checking online forms is a very simple process. It will be limited to coding a simple web form, which will be comprised of a few text boxes to allow a user to enter typical data, such as the user's First name, Last Name, and finally an email address.

    Based on the above description, here is the respective (X)HTML markup code that constructs the sample form in question:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/
    xhtml1-transitional.dtd">
      <html>
      <head>
        <title>AJAX-BASED FORM VALIDATOR</title>
      </head>
      <body>
        <div><p>AJAX-BASED FORM VALIDATOR</p></div>
        <div id="formcontainer">
          <form method="post" action="nextpage.php">
            <p>First Name <input name="fname" type="text" required="Empty" class="inputbox" title="Enter your First Name (at least 8 characters)" /></p>
            <p>Last Name <input name="lname" type="text" required="Empty" class="inputbox" title="Enter your Last Name (at least 8 characters)" /></p>
            <p>Email <input name="email" type="text" required="EmailWin" class="inputbox" title="Enter a valid email address" /></p>
            <p><input type="submit" value="Send Data" class="formbutton" /></p>
          </form>
        <div>
      </body>
      </html>

    As you can see, the (X)HTML markup code listed above renders a simple online form, which is made up of three text fields: First Name, Last Name and Email respectively. Additionally, I added a "required" attribute to each field, indicating that these boxes must be filled. However don't you worry about the values assigned to this attribute, since I'll explain its correct meaning when I cover the development of the corresponding PHP validation routines later on.

    So far, I created the basic structure of the sample online form, which will be used for testing the capabilities of this AJAX-based application, handy for validating forms. Now, the next logical step consists of tying the corresponding CSS styles to each element of the aforementioned form, to make it look a little more appealing and polished.

    With reference to spicing up the corresponding sample form, I recommend you  read the next section so you can see how this will be done. Don't worry, I'll be there waiting for you.

    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

    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - 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...







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