validating inputs


Clonefish supports both client-side form validation (with cross-browser JavaScript) and parallel server-side form validation with PHP.

Validation rules can be combined (you can validate a single input element against any number of rules), and you can even set up dependencies, when the actual value of a field determines if another field has to be validated.

We know, lists are boring, but this one is quite impressive:

  • Required validation: quick validation for several inputs.
    • text, hidden, password, textarea: length > 0 without the trailing and leading whitespaces
    • checkbox: must be checked
    • checkboxDynamic: a specified number (min/max) of checkboxes must be checked
    • radiobuttons or a multiple select: requires at least one option to be selected
  • string validation: min/max length, matching/non-matching regexp, equality with other field
  • number validation: min/max values, integer or real numbers
  • date validation: match specified date format (like YYYY-MM-DD, DD-MM-YYYY, YYYY-MM-DD hh:mm:ss, etc). Compare a date to be > or < than value of another field.
  • file validation: file upload required or not, file type (one or more from JPG, GIF, PNG, etc.), file size (min/max), optional createimagefrom*() check to ensure images can be processed using PHP.
  • database validation: validate against an SQL query (query may include any input values). The results can be checked for exact value match or number of rows (min/max).
  • CAPTCHA validation: match value of a SESSION variable (case sensitive or insensitive)
  • custom validation: any user function call
  • own validation types: extend Clonefish with your own regularly used validation types
     

affiliate program!

Do you run a PHP blog or related website? Join as an affiliate and earn money!
know more

form validation for developers!

clonefish is a proven, mature form generator class that helps PHP developers to create, validate and process secure, flexible and easy-to-maintain forms
learn more
Bookmark and Share