خلال تعامل مع العنصر وجدت خطأ برمجي و قد قمت بمساعدة الشباب الطيبة بحل المشكلة ، و المشكلة هي في عملية اخراج العناصر في حال وجود عنصرين من العناصر من نوع تاريخ الميلاد
حيث عوضاً عن ظهور عنصرين يظهر لدينا ثلاثة عناصر ، على كل قما بعد تبين الخطأ و أصلحته ، لذلك أقوم بوضع التصحيح ، و لكن قبل كتابة التصحيح سأكتب الخطأ :
الخطأ كان في
$this->html
حيث انه من الواجب كتابته كالتالي :
$html
و أترككم مع التصحيح :
الكود البرمجي لـ View Helper الخاص بالعنصر :
/*
* This file was created by Creative Web Group Syria , Developement Team
* website : http://www.creativewebgroup-sy.com
* email : info@creativewebgroup-sy.com
*/
/**
*
* @author Creative Web Group Syria
*/
class Msrofi_View_Helper_BirthElement
extends Zend_View_Helper_FormElement
{
protected $html = '';
public function birthElement($name, $value = null, $attribs = null , $options = null)
{
$day = $month = $year = '';
if (is_array($value)){
$day = (isset($value['day'])) ? $value['day'] : '';
$month = (isset($value['month'])) ? $value['month'] : '';
$year = (isset($value['year'])) ? $value['year'] : '';
}else{
list($year, $month , $day) = split('-',$value);
}
$helper = new Zend_View_Helper_FormSelect();
$helper->setView($this->view);
$html .= $helper->formSelect($name . '[day]', $day , null, $options['day']);
$html .= ' / ' .$helper->formSelect($name . '[month]', $month , null, $options['month']);
$html .= ' / ' .$helper->formSelect($name . '[year]', $year , null, $options['year']);
return $html;
}
}
المقال الرئيسي السابق قبل حل المشكلة موجود على الرابط :
http://www.mhdzaherghaibeh.name/posts/dateofbirth-element-in-zend-framework/

التنبيهات: عنصر تاريخ الميلاد في زيند « محمد زاهر غيبة