ajax form validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradeepjain
    Contributor
    • Jul 2007
    • 563

    #1

    ajax form validation

    hii guys ,
    I wanna share a very gud ajax validation script with php...
    Ajax Form Validation - sForm | chains.ch weblog

    I am very new to ajax .So i wanna small help....i want to improve that script with adding checkbox,radiob utton validation and dropdown list validation . but i am not able to do it.....any one can add his/her code into that ajax script..tht i can have a look at it..

    And i have found a small bug in tht script ...say the submit button will be active by default which it shld not be..


    thanks,
    Pradeep
  • Logician
    New Member
    • Feb 2007
    • 210

    #2
    Originally posted by pradeepjain
    hii guys ,
    I wanna share a very gud ajax validation script with php...
    Ajax Form Validation - sForm | chains.ch weblog
    I cannot see the point of that code; it makes multiple server requests to perform a task that can be done client-side. It's certainly no substitute for conventional server-side validation, which is still essential. It looks like AJAX for the sake of it.

    Comment

    • pradeepjain
      Contributor
      • Jul 2007
      • 563

      #3
      Originally posted by Logician
      I cannot see the point of that code; it makes multiple server requests to perform a task that can be done client-side. It's certainly no substitute for conventional server-side validation, which is still essential. It looks like AJAX for the sake of it.
      so wht do u think....ajax validation for client side is waste of resource is it....so we need to make a client side and server side validation is it...so whats the main use of ajax ..where must we use it..

      Comment

      • moltendorf
        New Member
        • Jul 2007
        • 65

        #4
        Ajax is good for validating specific things that would be too much to send in the initial document. Like for a checkbox it would be best to use a server side to throw in a variable that you would use to ensure the form is filled out correctly.

        Code:
        form.onsubmit = function ()
        {
        return (window.getElementById ("tosagreed").checked == (true))
        }
        Ajax would be good for (these are examples)...
        1. Checking that a username isn't already taken.
        2. Getting a long list of cities/provinces and sticking them into a drop down box when a user picks a specific country/state.
        3. Getting a list of online people on a page that is not meant to be refreshed (like a chat room).
        4. Saving stuff to the server you are actively editing (take a look at Google Documents, and Spreadsheets) so that you don't lose any information if your browser crashes.


        Ajax isn't really the best choice for some of the things that sForm uses it for. Email validation, for example, can be done without using Ajax at all. With or without Ajax, though, you should always use server-side verification for everything no matter what. Because if it's client-side, they can get around it. The purpose of Ajax is to let users know that they are good to go before they submit, knowing they probably wont get a, "you filled the form out wrong!"

        Comment

        Working...