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

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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?