public function init() { $subject = new Monkeys_Form_Element_Text('subject'); translate('Subject'); $subject->setLabel('Subject')->setRequired(true); $cc = new Monkeys_Form_Element_Text('cc'); translate('CC'); $cc->setLabel('CC'); $bodyPlain = new Monkeys_Form_Element_Textarea('bodyPlain'); $bodyPlain->setDecoratorOptions(array('separateLine' => true)); $bodyHTML = new Monkeys_Form_Element_Richtextarea('bodyHTML'); $bodyHTML->setDecoratorOptions(array('separateLine' => true))->setAttrib('width', '510px'); $this->addElements(array($subject, $cc, $bodyPlain, $bodyHTML)); }
public function init() { $title = new Monkeys_Form_Element_Text('title'); translate('Title'); $title->setLabel('Title')->setRequired(true)->setAttrib('style', 'width:350px'); $date = new Monkeys_Form_Element_DateTime('date'); translate('Publication date'); $date->setLabel('Publication date')->setShowEmptyValues(false)->setStartEndYear(1900, date('Y') + 1)->setReverseYears(true)->setValue(date('Y-m-d H:i')); $excerpt = new Monkeys_Form_Element_Textarea('excerpt'); translate('Excerpt'); $excerpt->setLabel('Excerpt')->setAttrib('style', 'width:350px')->setAttrib('rows', 4); $content = new Monkeys_Form_Element_Richtextarea('content'); $content->setDecoratorOptions(array('separateLine' => true))->setAttrib('width', '510px')->setRequired(true); $this->addElements(array($title, $date, $excerpt, $content)); }
public function init() { $name = new Monkeys_Form_Element_Text('name'); translate('Enter your name'); $name->setLabel('Enter your name')->setRequired(true); $email = new Monkeys_Form_Element_Text('email'); translate('Enter your E-mail'); $email->setLabel('Enter your E-mail')->addFilter('StringToLower')->setRequired(true)->addValidator('EmailAddress'); $feedback = new Monkeys_Form_Element_Textarea('feedback'); translate('Enter your questions or comments'); $feedback->setLabel('Enter your questions or comments')->setRequired(true)->setAttrib('cols', 60)->setAttrib('rows', 4); // ZF has some bugs when using mutators here, so I have to use the config array translate('Please enter the text below'); $captcha = new Monkeys_Form_Element_Captcha('captcha', array('label' => 'Please enter the text below', 'captcha' => array('captcha' => 'Image', 'sessionClass' => get_class(Zend_Registry::get('appSession')), 'font' => APP_DIR . '/libs/Monkeys/fonts/Verdana.ttf', 'imgDir' => WEB_DIR . '/captchas', 'imgUrl' => $this->_baseWebDir . '/captchas', 'wordLen' => 4, 'fontSize' => 30, 'timeout' => 300))); $this->addElements(array($name, $email, $feedback, $captcha)); }