dtny30176
2015-06-03 13:09
浏览 16
已采纳

cakephp 3表单验证notEmpty

I set the title field to be required.

$validator
->requirePresence('title', 'create')
->notEmpty('title');

the problem is that the title input is not marked as required. I don't have this problem with another table.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drn34916 2015-06-03 13:19
    已采纳

    I found the answer after an hour. it was a little mistake.

    in controller action I wrote:

    $this->set('gallery');
    

    while I should do this:

    $this->set('gallery',$gallery);
    

    sorry for wasting your time.

    点赞 打赏 评论

相关推荐 更多相似问题