开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜