Latest news
Home » SocialEngine » Pass custom error messages to form in socialengine / zend framework

Pass custom error messages to form in socialengine / zend framework

if( !$form->isValid($this->getRequest()->getPost()) ) {
return;
}

// Process
$values = $form->getValues();
if( ($CouponCode = $form->getElement(‘coupon_code’)) &&
isset($values[‘coupon_code’])) {
$iCouponExist = $table->checkCouponExist($values[‘coupon_code’]);
if($iCouponExist == 1) {
return $CouponCode->addError(‘This Coupon Code is not available, please use another one.’);
}
}

Leave a Reply

x

Check Also

Get parameter value in socialengine or zendframework

Get parameter value in socialengine/zendframework $this->_getParam(‘id’, null) $this->getRequest()->getParam(‘fancybox’, null);