I'm new to CakePHP. I tried to change the default class error-message
to error
by following the official docs this way:
<?php
echo $this->Form->create('Post', array(
'inputDefaults' => array(
'error' => array(
'wrap' => 'small',
'class' => 'error'
)
)
)); ?>
But when error occurred, it still uses the default div.error-message
.
I also tried to set the code to each individual input
. But still no effect:
$this->Form->input('title', array('error' => array('wrap' => 'small', 'class' => 'error')));
I'm using CakePHP 2.3.2
Any solution? Thanks
Oops, I read the 1.3 Documentation which is not compatible with 2.3.
For version 2.0 above, we need to add attributes
array inside the error
array:
<?php
echo $this->Form->create('Post', array(
'inputDefaults' => array(
'error' => array(
'attributes' => array(
'wrap' => 'small', 'class' => 'error'
)
)
)
)); ?>
Thanks