1
我對zend非空驗證存在誤解。我使用下面的代碼Zend的形式產生textarea
以zend格式添加非空驗證
$this->addElement('textarea', 'comment', array(
// 'label' => 'Please Comment:',
'required' => false,
'validators' => array('NotEmpty')
));
如果我改變required
屬性設置爲false,然後它的工作原理和價值觀都沒有去數據庫。但問題是,如果我設置requried=>true
,它甚至會在提交表單之前顯示驗證消息,如Value is required and can't be empty
。 現在我希望在提交表單之前不應該顯示此消息,但應該執行非空驗證。請指導我錯在哪裏?