/** * Konfiguriert das Formularelement. */ public function init() { parent::init(); $this->setAttrib('placeholder', $this->getTranslator()->translate('email_format')); $this->setAttrib('size', 60); $validator = new Zend_Validate_EmailAddress(); $validator->setMessage('admin_validate_error_email'); $this->addValidator($validator); }
public function init() { parent::init(); $this->setLabel($this->getName()); $validator = new Form_Validate_Date(); $validator->setMessages(array(Zend_Validate_Date::INVALID => 'validation_error_date_invalid', Zend_Validate_Date::INVALID_DATE => 'validation_error_date_invaliddate', Zend_Validate_Date::FALSEFORMAT => 'validation_error_date_falseformat')); $this->setValidators(array($validator)); $this->setAttrib('placeholder', $this->getTranslator()->translate('date_format')); $this->setAttrib('size', 12); $this->setAttrib('maxlength', 10); }
public function init() { parent::init(); if (is_null($this->getAttrib('size'))) { $this->setAttrib('size', 6); } $validator = new Zend_Validate_Int(); $validator->setMessage('validation_error_int'); $this->addValidator($validator); $validator = new Zend_Validate_GreaterThan(-1); $validator->setMessage('validation_error_negative_number'); $this->addValidator($validator); }
public function setValue($file) { if (is_null($file)) { throw new Application_Exception(__METHOD__ . " Value must not be null."); } if (!$file instanceof Opus_File) { try { $file = new Opus_File($file); } catch (Opus_Model_NotFoundException $omnfe) { throw new Application_Exception("File with ID = {$file} not found."); } } if (!$file->exists()) { $this->addError('admin_filemanager_file_does_not_exist'); } parent::setValue($file); }
public function init() { parent::init(); $this->setLabel($this->getName()); // TODO use prefix for translation $validators = array(); $validator = new Zend_Validate_Int(); $validator->setMessage('validation_error_year_invalid_format'); $validators[] = $validator; $validator = new Zend_Validate_GreaterThan(-1); $validator->setMessages(array(Zend_Validate_GreaterThan::NOT_GREATER => 'validation_error_year_invalid_negative')); $validators[] = $validator; $validator = new Zend_Validate_LessThan(10000); $validator->setMessages(array(Zend_Validate_LessThan::NOT_LESS => 'validation_error_year_too_large')); $validators[] = $validator; $this->setAttrib('placeholder', $this->getTranslator()->translate('year_format')); $this->setAttrib('size', 6); $this->setAttrib('maxlength', 4); $this->setValidators($validators, true); }