/** * Form initialization * * @return void */ public function init() { $this->setName('questionForm'); $this->setMethod('post'); $question = new Zend_Form_Element_Text('question'); $question->setLabel('Question:')->setRequired(true)->addDecorators($this->_inputDecorators); $question->setAttrib('class', 'span8'); $this->addElement($question); $answer = new Core_Form_Element_Redactor('answer', array('label' => 'Answer:', 'cols' => 50, 'rows' => 15, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/faq/images/upload/', 'imageGetJson' => '/faq/images/list/', 'fileUpload' => false))); $answer->addDecorators($this->_inputDecorators); $this->addElement($answer); $this->addElement($this->_submit()); }
/** * Form initialization * * @return void */ public function init() { $this->setName('postForm'); $this->setMethod('post'); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->setRequired(true)->setAttribs(array('class' => 'span4'))->addValidator('regex', false, array('/^[\\w\\s\'",.\\-_]+$/i', 'messages' => array(Zend_Validate_Regex::INVALID => 'Invalid title', Zend_Validate_Regex::NOT_MATCH => 'Invalid title'))); $this->addElement($title); $body = new Core_Form_Element_Redactor('body', array('label' => 'Text', 'cols' => 50, 'rows' => 25, 'required' => true, 'filters' => array('StringTrim'), 'redactor' => array('imageUpload' => '/forum/images/upload/', 'imageGetJson' => '/forum/images/list/', 'fileUpload' => '/admin/files/upload/', 'fileDownload' => '/admin/files/download/?file=', 'fileDelete' => '/admin/files/delete/?file='))); $body->addDecorators($this->_inputDecorators); $this->addElement($body); $this->addElement($body); $this->addElement($this->_category()); $this->addElement($this->_status()); $this->addElement($this->_submit()); $this->addElement(new Zend_Form_Element_Hidden('pid')); }