我有以下形式:CakePHP的验证工作不
<?php echo $this->Html->image('itemdefault.gif',array('class'=>'image1')); ?>
<?php echo $this->form->input('quantity',array('class'=>'input')); ?><br>
<?php echo $this->form->input('SpecialInstructions', array('type'=>'select','style'=>'font-size:13pt;width:120px;','options'=>$spec_ins)); ?><br>
<?php echo $this->form->input('Ingredients',array('class'=>'input')); ?><br>
<?php echo $this->form->end('Save',array('class'=>'button1'));
,这是在模型验证:
var $validate=array
(
'quantity'=>array
(
'numeric'=>array('rule'=>'numeric','required'=>true,'message'=>'Enter numbers only'),
'qty_must_not_be_blank'=>array('rule'=>'notEmpty','message'=>'Quantity cannot be left blank')
),
'Ingredients'=>array
(
'body_must-not_be_blank'=>array('rule'=>'notEmpty','message'=>'Body must not be blank')
)
);
但没有验证的工作。是因为这些字段不存在于我的数据库中?
您如何知道验证无效?你是怎么测试的? –
在您的问题中加入更多详细信息以进行澄清 – Anubhav