addElement('text', 'name', array('label' => 'Your Name', 'required' => true)); $this->addElement('email', 'email', array('label' => 'Email Address', 'required' => true)); $this->addElement('phone', 'phone', array('label' => 'Phone Number')); if ($this->_hasReason) { $this->addElement( 'select', 'idReason', array( 'label' => 'Reason for Contact', 'required' => true, 'multiOptions' => array('' => '- Select Reason -') + (array) $this->_reasons ) ); } $this->addElement('textarea', 'comments', array('label' => 'Comments', 'required' => true)); $this->addElement('captcha', 'captcha'); return $this; } protected function _initButtons() { $this->addElement('submit', 'btnSubmit', array( 'label' => 'Submit', 'attribs' => array('class' => 'btn'), ) ); $this->addDisplayGroup(array('btnSubmit'), 'submitGroup'); } public function setHasReason($hasReason) { $this->_hasReason = (bool) $hasReason; return $this; } public function setReasons(array $reasons) { $this->_reasons = $reasons; return $this; } }