我必须建立我的习惯<条码>:isvalid(>,载于我的<条码>。 如下文所示,因为我必须检查这2个领域中是否至少填满了:
class Products_AddForm extends Zend_Form {
public function isValid($data)
{
// Check special post data
$pzn_val = $data[ PZN ];
$mar_val = $data[ PZO ];
if(empty($pzn_val) && empty($mar_val)) {
$this->getSubForm( sub1 )->getElement( PZN )->setErrors(array( PZN or PZO needed ));
$this->getSubForm( sub2 )->getElement( PZO )->setErrors(array( PZN or PZO needed ));
}
// Standard validation
return parent::isValid($data);
}
The errors for PZN
and PZO
will only fire if another error (other field) will be found.
How can I get the form error
?
Field PZN
and PZO
are defined as not required
.
TIA Matt