Re: seeking data validation class

From: Date: Sat, 28 Sep 2002 01:09:39 +0000
Subject: Re: seeking data validation class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-117907@lists.php.net to get a copy of this message
Hello, On 09/27/2002 09:50 PM, Peter J. Schoenster wrote:
I looked at phpclasses but saw nothing as simple as I wanted. There's a Perl module which does just what I want and perhaps I'll have to port it. The class accepts an assoc array of name=>value, and the key to another assoc array which describes the constraints for the assoc array I'm passing in. Here is an example of the assoc array (it's Perl) which contains all my "forms" and then the class returns 3 assoc arrays (valid, invalid,missing using the key names, and this makes it very easy to use in your templates e.g. if missing_name, or invalid_zipcode etc.). my %forms = (
    confirm_email => {
        required     =>
              [ qw(emailaddress emailaddress_verified searchengine_accounts) ],
        constraints  =>
      {
          emailaddress_verified => "email",
          emailaddress   => "email",
      },
      filters       => [ "trim" ],
    },
    verify_contact_info => {
        required     =>
              [ qw(country lastname firstname phone state zipcode city company street) ],
        optional     =>
        [ qw(fax) ],                      constraints  =>
      {
          #phone          => "american_phone",
          #zipcode        => '/^\s*\d{5}(?:[-]\d{4})?\s*$/',
          state          => '/\w{2,}/',
          #fax            => "american_phone",
      },
      filters       => [ "trim" ],
      field_filters => { phone => ["phone"] },
    },
The Perl module that does this is: HTML::FormValidator So far I'm find PHP stuff that does everything under the sun. Anyone know of something like this?
Assumming that you tried the forms generation and validation class, what did you realize that was missing to match your needs? http://www.phpclasses.org/formsgeneration -- Regards, Manuel Lemos

« previous php.general (#117907) next »