cakePHP: how set error validation to input field manually in controller

后端 未结 6 462
南旧
南旧 2021-01-12 00:15

I want set error validation to input field manually in controller example:

  if ($remainTime < 30) {
      ..... set error validation in here (error: lim         


        
6条回答
  •  我在风中等你
    2021-01-12 00:45

    Since a lot has passed since this has been answered in order to pass correct message you need to put it like this:

    $this->Model->validationErrors['limitTime'] = array("time is less than 30");
    

    Form is expecting array of error messages.

提交回复
热议问题