Apply for Zend Framework Certification Training

Zend Framework 2




Zend Form Validation Library is used to Protect
Databases to Insert Wrong Value
Some of the Important Classes i am going to discuss
For Email Validation
    $emailValidator = new Zend\Validator\EmailAddress();
For String Length Max and Min
    $StringLength = new Zend\Validator\StringLength(8);
    $StringLength = new Zend\Validator\StringLength(array('min'=>8,'max'=>12));
For Validation Messages
    $stringLength->setMessages(array(
           Zend\Validator\StringLength::TOO_SHORT=>'The String \'%value%\' is too Short',
           Zend\Validator\StringLength::TOO_LONG=>'The String\'%value%\' is too Long));
For Date Validation
    $dateValidator = new Zend\Validator\Date();
    $dateValidator->isValid('2016-11-19');   // returns true
    $dateValidator->isValid('19.11.2016');   // returns false
For Digits Validation
    $digitval = new Zend\Validator\Digits();
    $digitval->isValid("98764567890");       // returns true
    $digitval->isValid(45678);                     // returns true
    $digitval->isValid('56v2b34');                // returns false
To Check Existence of File
    $file = new Zend\Validator\File\Exists('//images');
    if($file->isValid('//images/abc.jpg'))
    {
             ///True
     }
                                    

< First Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top