Need a really good form validator script

    Date: 11/04/05 (Javascript Community)    Keywords: php, java, web

    Hi guys,

    I've spent the last two days sourcing the web for a javascript form validator. I'm pretty decent with php, which is why I've avoided using js for so long (I just did all my validation server-side), but I find myself in need now.

    As you might guess, I've found heaps and heaps of js form validators, but none of them are quite right. In a nutshell, I'm looking for a single function that I can use <form ... onSubmit="return validate(this);"> to validate ANY form across my site. I want to check


    • presence of any data (for required fields)

    • valid date format (dd/mm/yyyy OR mm/yyyy)

    • check that an "EndDate" field is greater than a "StartDate" field

    • valid time format (h:mm or hh:mm or HH:MM)

    • valid currency format ($DD or $DD.cc)

    • valid number format (no alpha characters)

    • valid state (QLD OR NSW OR ACT OR VIC OR TAS OR NT OR SA OR WA)

    • valid 4-digit post code (exactly four numbers)

    • valid email address format

    • valid selection (from a
      « Java Script book... || Why this this failing??? »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home