How to add a class to all the input elements inside a form in cakephp
How do i use th开发者_运维知识库e inputDefaults
to add a common class to all the input elements in my form. also pls give a brief description of the inputDefaults
.
isn't it:
echo $this->Form->create('User', array( 'inputDefaults' => array( 'class' => 'someclass' ) );
`
You should read the cookbook. theres a good example: http://book.cakephp.org/view/1639/options-inputDefaults
When you create a form you add inputdefaults key in options:
echo $this->Form->create('User', array(
'inputDefaults' => array(
'div' => array('class' => 'someclass')
)
);
After browsing the source file i didn't find anything either. So the only way is to use it explicitly for every call to the input
function.
精彩评论