【发布时间】:2010-05-04 20:06:58
【问题描述】:
使用 CakePHP 表单助手创建单选表单时,我无法显示错误消息。
这就是我现在所拥有的。
$options=array('active'=>'Active','inactive'=>'Inactive');
echo $form->input('Status', array(
'type' => 'radio',
'id' => 'EntryStatus',
'name' => 'data[Entry][status]',
'options' => $options
));
我错过了什么?
我正在使用 CakePHP 1.2.7,这就是我在验证中所拥有的
'status' => array(
'notempty' => array(
'rule' => 'notempty',
'required' => true,
'message' => 'yo'
)
)
尝试了Form helper for creating Radio button in Cakephp 的答案,它给了我一个选择选项表单。
谢谢,
三通
【问题讨论】:
-
您提供的验证码与之前的代码有何关系?
-
“notempty”是否区分大小写? CakePHP 网站有驼峰式 - 不是小写:book.cakephp.org/view/740/notEmpty
-
感谢大家的回复。是的,验证似乎有效,如果我没有为状态单选按钮选择任何内容,它就不会插入表单。我遇到的问题是,通常显示在表单下方的“哟”错误消息没有显示出来,应该在表单助手中构建。
标签: cakephp