age-validator Validates min/max age by birthdate

  1. Installation
  2. Usage
  3. License
  4. Contacts

Installation

  1. Place EAgeValidator.php to /protected/extensions/validators/age/ or any convenient directory
  2. Add path alias of extension to import section if you dont want to use full paths to EAgeValidator in your models.

Usage

#method of your model class, that you need to validate
public function rules()
{
    return array(
        
        # If you imported ext.validators.age.EAgeValidator or placed EAgeValidator.php
        # to directory, that is imported (for example, protected/components)
        array('your_birthdate_field_name1', 'EAgeValidator'),
        ...
        # With options and full path to extension   
        array('your_birthdate_field_name2', 'ext.validators.age.EAgeValidator',                    
                  'minAge'=>16, 
                  'maxAge'=>120, 
                  'allowEmpty'=>false
        ),
        ...
    );
}

License

BSD

Contacts

6 0
10 followers
887 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Developed by: Nayjest
Created on: Apr 15, 2011
Last updated: 13 years ago

Downloads

show all

Related Extensions