问题
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