cakephp form validation

↘锁芯ラ 提交于 2020-01-21 05:45:08

问题


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 function, i just need to know if the data i send is valid and review the errors manually.


回答1:


Try this

$this->ModelName->set( $this->data );

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

And read this



来源:https://stackoverflow.com/questions/3343472/cakephp-form-validation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!