cakephp form validation

后端 未结 1 1653
长情又很酷
长情又很酷 2021-01-06 23:14

does anyone know if there is a VALIDATE function for a form in cakePHP and view the errors array? i.ve checked the documentation but the only thing i found is the SAVE func

相关标签:
1条回答
  • 2021-01-06 23:51

    Try this

    $this->ModelName->set( $this->data );
    
    if ($this->ModelName->validates()) {
      // it validated logic
    } else {
      // didn't validate logic
    }
    

    And read this

    0 讨论(0)
提交回复
热议问题