CakePHP : Validation message not displaying

前端 未结 3 1512
暗喜
暗喜 2021-02-06 17:19

I\'m new to cakePHP and I\'ve made a simple form following some tutorial. On this html form I\'ve used validation. Now the problem is that the validation is working but the mess

3条回答
  •  逝去的感伤
    2021-02-06 17:52

    That's built-in browser validation.

    Since 2.3 the HTML5 required attribute will also be added to the input based on validation rules.

    Your title has the notEmpty rule, so Cake is outputting

    and your browser is triggering that message.

    Edit: to override this behaviour, you can do:

    $this->Form->input('title', array('required'=>false));
    

    or

    $this->Form->submit('Submit', array('formnovalidate' => true));
    

    When you submit the form, your model validation will fire.

提交回复
热议问题