如何在输入字段中更改cakephp 3中的html模式错误消息

时间:2016-06-01 11:06:45

标签: html5 forms validation cakephp cakephp-3.0

输入字段: 如何在html 5中的输入字段中使用的模式中自定义错误消息。

当前消息显示"请输入与模式匹配的值"定制后的按摩秀"仅允许数字编号&​​#34;

<?= $this->Form->input('mobile', 
['pattern'=>"^(?!0)[0-9]{10}$",
'label' => false, 'id' => '',
 'class' => 'form-control reg_mobile_input',
'required' => true,'id'=>'',
'placeholder'=>'without initail zero',]); 
?>

1 个答案:

答案 0 :(得分:0)

您可以通过将它们传递给表单助手来设置大多数属性,以便以下内容起作用:

SinksConfig

有关自定义HTML错误消息的详情,请参阅MDN docs on setCustomValidity

相关问题