CakePHP Validation Error Message

China☆狼群 提交于 2019-12-23 19:26:42

问题


I am trying to modify the way CakePHP shows the error message. Below is the generic template that it uses to display errors

<div class="error-message">Please enter at least 3 characters.</div>

I want to style the error like below.

<label class="error">Please enter at least 3 characters.</label>

回答1:


this did the job. i was missing the text parameter.

 <?php echo $this->Form->error('name', null, array('wrap' => 'label', 'class' => 'error')); ?>



回答2:


echo $this->Form->label("Please enter at least 3 xter",array('class'=>'error');



来源:https://stackoverflow.com/questions/10362875/cakephp-validation-error-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!