关注http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html。我可以使用inputDefaults
为每个表单字段提供课程,但现在:
必需:我想将某些特定输入中的类(say myClass)
附加到inputDefaults继承的那些。
'inputDefaults' => array(
'label' => false,
'div' => 'form-group',
'class' => 'col-sm-6 form-control'
)
每个输入字段
<input type="email" id="LoginEmail" maxlength="100" required="required" placeholder="Email" class="col-sm-6 form-control" name="data[Login][email]" />
如果我尝试:
echo $this->Form->input("email", array("placeholder" => "Email", "required" => "required", "class" => "myClass"));
我
<input type="email" id="LoginEmail" maxlength="100" required="required" placeholder="Email" class="myClass" name="data[Login][email]" />
我想跟随
<input type="email" id="LoginEmail" maxlength="100" required="required" placeholder="Email" class="col-sm-6 form-control myClass" name="data[Login][email]" />
提前致谢!
答案 0 :(得分:1)
当您尝试使用带有cakephp的twitter bootstrap时,您可能会发现https://github.com/Codaxis/cakephp-bootstrap3-helpers#installation已编码的表单助手
将Bs3Helpers.Bs3Form
一个别名添加到std Form
,如安装部分所示,并在bootstrap.php中配置帮助程序。
另一个提示是烘焙脚本模板:https://github.com/ptica/BootstrapCake