我已经在我的字段中尝试了以下验证。
我的字段是标题,内容。
var $validate = array('title' =>array('alphaNumeric'=>array('rule'=>'alphaNumeric','required'=>'true','message'=>'Enter a title for this post',)),
'content'=>array('alphaNumeric'=>array('rule'=>'alphaNumeric','required'=>'true','message'=>'Enter some content for this post',)));
但是每当我在表单中输入一些文本并尝试提交时,它都会显示错误消息...
验证有什么问题吗?
这是我的表格
<h2> Add a Post Here </h2>
Please fill in all the fields.
<?php
echo $this->form->create('Post');
echo $this->form->error('Post.title');
echo $this->form- >input('Post.title',array('id'=>'posttitle','label'=>'title','size'=>'50','maxlength'=>'255','error'=>false));
echo $this->form->error('Post.content');
echo $this->form->input('Post.content',array('id'=>'postcontent','type'=>'textarea','label'=>'Content:','rows'=>'10','error'=>false));
echo $this->form->end(array('label'=>'Submit Post'));
?>