Zend EmailAddress Validation returning multiple errors

前端 未结 4 1149
悲&欢浪女
悲&欢浪女 2021-01-15 10:36

I am unable to make Zend_Validate_EmailAddress show only 1 error message when the user enter invalid email address. The code is

$email = new Zend_Form_Elemen         


        
4条回答
  •  一生所求
    2021-01-15 10:49

    Try this,

    $po = $this->getRequest()->getPost();
    $email = $po['email'];
    $emval = new Zend_Validate_EmailAddress();
    if (!$emval->isValid($email)) {
    $this->view->emailerror = "Please enter a valid email ID.";
    }
    

    And in its view page put the code below where you want to display that error message,

           echo $this->emailerror;
    

提交回复
热议问题