Skip to content

Additional form and data validators extending the inbuilt phalcon validate interface.

License

Notifications You must be signed in to change notification settings

zVPS/zvps-phalcon-validators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Phalcon Validators

Issues with the Alpha and Numeric validators have been fixed for UTF8 support:

phalcon/cphalcon#11386 phalcon/cphalcon#11374

However if you which to validate with whitespace or space characters then these validators may still come in handy.

Example usage

<?php

class LoginForm extends Form
{
    public function initialize($entity = null, $options = null)
    {

        $username = new Text('username', array(
            'class' => 'form-control'
        ));
        $username->setLabel('Username');
        $username->addValidators(array(
            new PresenceOf(array(
                'message' => 'Please enter your username.',
            )),
            new AlphaNumericValidator(array(
                'message' => 'Only Alpha, Numeric and Space characters please.', 
                'allowWhiteSpace' => true,
            )),
            new StringLength(array(
                'max' => 100,
                'messageMaximum' => 'Username is too long. Maximum 100 characters.',
            )),
        ));
        $this->add($username);

Pull Requests

Pull requests are more than welcome!

About

Additional form and data validators extending the inbuilt phalcon validate interface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages