addElement('html', 'denotes', array('value' => '
All fields are required
' . '') ); $form->addElement('text', 'name', array('label' => 'Name:', 'required' => true)); $form->addElement('text', 'emailOrPhone', array('label' => 'Email or Phone Number:', 'required' => true)); $form->addElement('select', 'areaOfInterest', array('label' => 'Area of Interest:', 'required' => true, 'multiOptions' => array('0' => 'Select One') + $this->dataObj->getAreasForSelect() ) ); $form->addElement('textarea', 'comments', array('label' => 'Your Message:', 'required' => true, 'rows' => 10)); $form->addElement('captcha', 'captcha'); $form->areaOfInterest->addValidator( 'GreaterThan', false, array( 'min' => 0, 'messages' => array(Zend_Validate_GreaterThan::NOT_GREATER => 'Area of interest is required') )); /* $form->emailOrPhone->addValidator('EmailAddress', false, array( 'messages' => array( Zend_Validate_EmailAddress::INVALID => 'Email Address is wrong', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Email Address is wrong', ), 'domain' => false, )); */ } protected function _bindFormButtons($form) { $form->addElement('submit', 'btnSubmit', array( 'label' => 'Submit Form', 'attribs' => array('class' => 'btn'), 'decorators' => array('ViewHelper') ) ); $decorators = array('FormElements'); $decorators[] = array('decorator' => 'HtmlTag', 'options' => array('tag' => 'div')); $decorators[] = 'Fieldset'; $decorators[] = 'DtDdWrapper'; $form->addDisplayGroup(array('btnSubmit', 'btnCancel'), 'submitGroup', array('decorators' => $decorators)); return $this; } protected function _getMailData(array $data) { $mailData = array( 'name' => htmlspecialchars($data['name']), 'emailOrPhone' => htmlspecialchars($data['emailOrPhone']), 'comments' => nl2br(htmlspecialchars($data['comments'])), 'areaOfInterest' => htmlspecialchars($data['areaOfInterest']), 'link' => BASE_URL . '/' . Qs_SiteMap::findFirst(null, array('type' => 'Form_Contact_Admin'), null, 'fullAlias') . '?action=view&id=' . $data['id'], ); return $mailData; } protected function _renderMainForm($form) { $item['tpl'] = $this->getTemplate('new.tpl'); $item['text'] = $form->render(); $item['templatePath'] = $this->_getTemplatePath(); $this->doc->addItem($item); return $this; } protected function _redirect() { $this->redirect(BASE_URL . '/contact-us/thanks.html'); } }