是否可以强制表单助手根据需要呈现字段,即使它不在CakePHP中? [英] Is it possible to force the form helper to render a field as required even if it isn't in CakePHP?
本文介绍了是否可以强制表单助手根据需要呈现字段,即使它不在CakePHP中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一些参数或解决方法我可以使用表单助手渲染一个字段,如果它是模型需要的,即使模型实际上不需要它吗?
Is there some parameter or workaround I can use to have the form helper render a field as if it were required by the model even if the model does not actually require it?
(我正在寻找cakephp所需的渲染类型,而不是实际的'required'表单属性,使这是一个不同的问题比 Cakephp Form Helper )
(I'm looking for the cakephp required rendering type, not the actual 'required' form property making this a different question than Cakephp Form Helper)
推荐答案
所有必需样式是一个特定的CSS类设置自己:
All the "required" style is is a specific CSS class you can set yourself:
$this->Form->input('foo', array('div' => array('class' => 'input text required')));
这篇关于是否可以强制表单助手根据需要呈现字段,即使它不在CakePHP中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文