本文整理汇总了PHP中Zend_Form_Element_Textarea::addValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::addValidator方法的具体用法?PHP Zend_Form_Element_Textarea::addValidator怎么用?PHP Zend_Form_Element_Textarea::addValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Textarea
的用法示例。
在下文中一共展示了Zend_Form_Element_Textarea::addValidator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$languageFile = Zend_Registry::get('languageFile');
$translate = new Zend_Translate('array', $languageFile, 'zh_CN');
$this->setTranslator($translate);
$this->setMethod('POST');
$this->setName('contactForm');
$element = new Zend_Form_Element_Text('name');
$element->setLabel('怎么称呼您');
$this->addElement($element);
$element = new Zend_Form_Element_Text('email');
$element->setLabel('您的Email');
//$element->setRequired(true);
$this->addElement($element);
$element = new Elements();
$element->addReCaptcha($this);
$this->addDisplayGroup(array('name', 'email', 'captcha'), 'leftSection');
$this->getDisplayGroup('leftSection')->removeDecorator('DtDdWrapper');
$element = new Zend_Form_Element_Textarea('body');
$element->setLabel('想要开通城市地区和找房贴士,关于您的简单介绍');
$element->addPrefixPath('My_Validator', 'My/Validator/', 'validate');
$element->addValidator('FormValueNotNull', true);
//$element->setRequired(true);
$element->setAttrib('rows', 13);
$this->addElement($element);
$this->addDisplayGroup(array('body'), 'rightSection');
$this->getDisplayGroup('rightSection')->removeDecorator('DtDdWrapper');
$element = new Zend_Form_Element_Submit('post');
$element->removeDecorator('Label');
$this->addElement($element);
}
示例2: init
public function init()
{
$media_library_model = new Cms_Model_MediaLibraries();
$media_library = $media_library_model->getByPath($this->_attribs['media_library_path']);
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Title');
$title->setRequired(true);
$title->addFilter('StringTrim');
$title->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($title);
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('Description');
$description->addFilter('StringTrim');
$description->addValidator('Alnum', false, array('allowWhiteSpace' => true));
$this->addElement($description);
$original = new Zend_Form_Element_File('original');
$original->addValidator('Count', false, 1);
$original->addValidator('Extension', false, 'jpeg,jpg,png');
$original->addFilter('Rename', $this->_attribs['file_name']);
$original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original'));
$original->setLabel('Image:');
$this->addElement($original);
$submit = new Zend_Form_Element_Submit('save');
$submit->setAttrib('class', 'btn btn-primary');
$submit->setLabel('Potvrdi');
$this->setAction('')->setMethod('post')->addElement($submit);
$cancel = new Zend_Form_Element_Button('cancel');
$cancel->setLabel('Cancel');
$cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
$cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'");
$this->addElement($cancel);
}
示例3: init
public function init()
{
$this->setName('send-tweet');
$e = new Zend_Form_Element_Text('latitude');
$e->setLabel('Latitude');
$e->addFilter('StringTrim');
$e->setAttrib('onblur', 'setMarkerFromForm()');
$e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
$e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en'));
$this->addElement($e);
$e = new Zend_Form_Element_Text('longitude');
$e->setLabel('Longitude');
$e->addFilter('StringTrim');
$e->setAttrib('onblur', 'setMarkerFromForm()');
$e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
$e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en'));
$this->addElement($e);
$e = new Zend_Form_Element_Textarea('tweet');
$e->setLabel('Tweet');
$e->setRequired(true);
$e->addFilter('StripTags');
$e->addFilter('StringTrim');
$e->addValidator(new Zend_Validate_StringLength(array('max' => 140)));
$e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en'));
$this->addElement($e);
$e = new Zend_Form_Element_Submit('send');
$e->setIgnore(true);
$e->setLabel('Tweet!');
$this->addElement($e);
}
示例4: init
public function init()
{
$this->setMethod('POST');
$this->setName('guestForm');
$element = new Zend_Form_Element_Text('name');
$element->setLabel('怎么称呼您');
$element->setDescription('必填,中英文都可,2到30个字');
$element->setRequired(true);
$this->addElement($element);
$element = new Zend_Form_Element_Text('email');
$element->setLabel('您的Email');
$element->setRequired(true);
$element->addValidator(new Zend_Validate_EmailAddress());
$element->addValidator('NotEmpty');
$element->setDescription('必填');
$this->addElement($element);
$element = new Zend_Form_Element_Textarea('body');
$element->setLabel('您的留言');
$element->setAttrib('rows', 4);
$element->addValidator('NotEmpty');
$this->addElement($element);
$element = new Elements();
$element->addReCaptcha($this);
$element = new Zend_Form_Element_Submit('post');
$element->setValue('提交')->removeDecorator('Label');
$this->addElement($element);
}
示例5: createAccountForm
/** account form */
public function createAccountForm($defaultValue = array())
{
$form = new Zend_Form();
$form->setAction($this->webroot . '/user/settings')->setMethod('post');
$email = new Zend_Form_Element_Text('email');
$email->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255)->addValidator('EmailAddress');
$firstname = new Zend_Form_Element_Text('firstname');
$firstname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255);
$lastname = new Zend_Form_Element_Text('lastname');
$lastname->setRequired(true)->addValidator('NotEmpty', true)->setAttrib('maxLength', 255);
$company = new Zend_Form_Element_Text('company');
$company->setAttrib('maxLength', 255);
$city = new Zend_Form_Element_Text('city');
$city->setAttrib('maxLength', 100);
$country = new Zend_Form_Element_Text('country');
$country->setAttrib('maxLength', 100);
$validator = new Zend_Validate_Callback(array('Zend_Uri', 'check'));
$website = new Zend_Form_Element_Text('website');
$website->setAttrib('maxLength', 255)->addValidator($validator);
$biography = new Zend_Form_Element_Textarea('biography');
$biography->addValidator(new Zend_Validate_Alnum());
$submit = new Zend_Form_Element_Submit('modifyAccount');
$submit->setLabel($this->t('Modify'));
$privacy = new Zend_Form_Element_Radio('privacy');
$privacy->addMultiOptions(array(MIDAS_USER_PUBLIC => $this->t('Public (Anyone can see my information, excluding email address)'), MIDAS_USER_PRIVATE => $this->t('Private (User information will be hidden)')))->setRequired(true)->setValue(MIDAS_COMMUNITY_PUBLIC);
if (isset($defaultValue['email'])) {
$email->setValue($defaultValue['email']);
}
if (isset($defaultValue['firstname'])) {
$firstname->setValue($defaultValue['firstname']);
}
if (isset($defaultValue['lastname'])) {
$lastname->setValue($defaultValue['lastname']);
}
if (isset($defaultValue['company'])) {
$company->setValue($defaultValue['company']);
}
if (isset($defaultValue['privacy'])) {
$privacy->setValue($defaultValue['privacy']);
}
if (isset($defaultValue['city'])) {
$city->setValue($defaultValue['city']);
}
if (isset($defaultValue['country'])) {
$country->setValue($defaultValue['country']);
}
if (isset($defaultValue['website'])) {
$website->setValue($defaultValue['website']);
}
if (isset($defaultValue['biography'])) {
$biography->setValue($defaultValue['biography']);
}
$form->addElements(array($email, $website, $city, $country, $biography, $firstname, $lastname, $company, $privacy, $submit));
return $form;
}
示例6: _motivo
protected function _motivo()
{
$e = new Zend_Form_Element_Textarea('motivo');
$e->setLabel(_('Reason') . ':');
$e->setRequired(true);
$e->setAttrib('rows', 4);
$e->setAttrib("data-parsley-required", "true");
$e->setAttrib('placeholder', _('Describe why you want to change your e-mail address...'));
$e->addFilter('StripTags');
$e->addFilter('StringTrim');
$e->addValidator('StringLength', false, array(10));
$e->setAttrib('class', 'form-control');
return $e;
}
示例7: init
public function init()
{
$this->setMethod('post')->setAction('/venta/registrar')->setAttrib('id', 'frmVenta')->setAttrib('style', 'width: 300px;margin:auto;');
// Comentarios
$e = new Zend_Form_Element_Textarea('comentarios');
$e->setLabel('Comentarios');
$e->setRequired(false);
$e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 100)));
$e->setAttrib('cols', '20');
$e->setAttrib('rows', '2');
$this->addElement($e);
//Submit
$e = new Zend_Form_Element_Submit('submit');
$e->setlabel('Registrar');
$this->addElement($e);
}
示例8: init
/** Initialize this form. */
public function init()
{
$this->setName('landingpage_admin');
$this->setMethod('POST');
$csrf = new Midas_Form_Element_Hash('csrf');
$csrf->setSalt('kUjBumZdEykrY8JHB88uzZjv');
$csrf->setDecorators(array('ViewHelper'));
$text = new Zend_Form_Element_Textarea(LANDINGPAGE_TEXT_KEY);
$text->setLabel('Landing Page Text');
$text->setRequired(true);
$text->addValidator('NotEmpty', true);
$text->setAttrib('cols', '80');
$text->setAttrib('rows', '40');
$this->addDisplayGroup(array($text), 'global');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Save');
$this->addElements(array($csrf, $text, $submit));
}
示例9: __construct
public function __construct()
{
// Validators --------------------------
$notEmpty = new Zend_Validate_NotEmpty(array(true));
$notEmpty->setMessage($this->_errorMessages['isEmpy']);
$digits = new Zend_Validate_Digits();
$digits->setMessage($this->_errorMessages['digits']);
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessage($this->_errorMessages['emailValidator']);
$foneValidator = new Zend_Validate_StringLength();
$foneValidator->setMin(8);
$foneValidator->setMessage($this->_errorMessages['foneValidator']);
//--------------------------------------
$nome = new Zend_Form_Element_Text('nome');
$nome->setAttrib('class', 'form-control');
$nome->setRequired(true);
$nome->addValidator($notEmpty, true);
//--------------------------------------------------------
$fone = new Zend_Form_Element_Text('fone');
$fone->setAttrib('class', 'form-control');
$fone->setRequired(true);
$fone->addValidator($notEmpty, true);
$fone->addValidator($digits, true);
$fone->addValidator($foneValidator, true);
//--------------------------------------------------------
$email = new Zend_Form_Element_Text('email');
$email->setAttrib('class', 'form-control');
$email->setRequired(true);
$email->addValidator($notEmpty, true);
$email->addValidator($emailValidator, true);
//--------------------------------------------------------
$mensagem = new Zend_Form_Element_Textarea('mensagem');
$mensagem->setAttrib('class', 'form-control');
$mensagem->setAttrib('cols', 30);
$mensagem->setAttrib('rows', 10);
$mensagem->setRequired(true);
$mensagem->addValidator($notEmpty, true);
//--------------------------------------------------------
$this->addElement($nome);
$this->addElement($fone);
$this->addElement($email);
$this->addElement($mensagem);
$this->setElementDecorators(array('ViewHelper', 'Errors'));
}
示例10: init
public function init()
{
$tr = Zend_Registry::get('tr');
$http_code = new Zend_Form_Element_Text('http_code');
$http_code->setLabel($tr->_('HTTP_CODE'));
$http_code->setRequired(false);
$this->addElement($http_code);
$name = new Zend_Form_Element_Text('name');
$name->setLabel($tr->_('NAME'));
$name->setRequired(true);
$name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
$this->addElement($name);
$msg = new Zend_Form_Element_Textarea('message');
$msg->setLabel($tr->_('ERROR_MESSAGE'));
$msg->setAttribs(array('rows' => 10, 'cols' => 35));
$msg->setRequired(true);
$msg->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
$this->addElement($msg);
/** Maybe next version will have it back.
$action = new Default_Model_Action;
$all = $action->getList();
$actions = new Zend_Form_Element_Multiselect('actions');
$actions->setLabel('Associated Actions with this Error');
$actions->setMultiOptions($all);
$actions->setAttrib('size', 8);
$this->addElement($actions);
*/
$desc = new Zend_Form_Element_Textarea('description');
$desc->cols = 35;
$desc->rows = 15;
$desc->setLabel($tr->_('DESCRIPTION'));
$desc->setRequired(false);
$this->addElement($desc);
$this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));
parent::init();
}
示例11: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'announcements');
$this->setAttrib('name', 'announcements');
$id = new Zend_Form_Element_Hidden('id');
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
if ($loginuserGroup == HR_GROUP) {
$businessunit_id = new Zend_Form_Element_Select("businessunit_id");
} else {
$businessunit_id = new Zend_Form_Element_Multiselect("businessunit_id");
}
$businessunit_id->setLabel("Business Units");
$businessunit_id->setRegisterInArrayValidator(false);
$businessunit_id->setRequired(true);
$businessunit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
$department_id = new Zend_Form_Element_Multiselect("department_id");
$department_id->setLabel("Departments");
$department_id->setRegisterInArrayValidator(false);
$department_id->setRequired(true);
$department_id->addValidator('NotEmpty', false, array('messages' => 'Please select department.'));
$title = new Zend_Form_Element_Text("title");
$title->setLabel("Title");
$title->setAttrib('maxLength', 100);
$title->addFilter(new Zend_Filter_StringTrim());
$title->setRequired(true);
$title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.'));
$title->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid title.')));
$title->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_announcements', 'field' => 'title', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1')));
// Validation for duplicate name is not required
$title->getValidator('Db_NoRecordExists')->setMessage('Title name already exists.');
$description = new Zend_Form_Element_Textarea('post_description');
$description->setLabel("Description");
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setRequired(true);
$description->addValidator('NotEmpty', false, array('messages' => 'Please enter post.'));
$this->addElements(array($id, $businessunit_id, $department_id, $title, $description));
$this->setElementDecorators(array('ViewHelper'));
}
示例12: init
public function init()
{
$this->setName(strtolower(get_class()));
$this->setMethod("post");
$oFormName = new Zend_Form_Element_Hidden("form_name");
$oFormName->setValue(get_class());
$oFormName->setIgnore(FALSE)->removeDecorator("Label");
$this->addElement($oFormName);
$oImageSrc = new Zend_Form_Element_Text("image_src");
$oImageSrc->setLabel("Nazwa wygenerowana:")->setFilters($this->_aFilters);
$oImageSrc->setRequired(FALSE);
$this->addElement($oImageSrc);
$oUserName = new Zend_Form_Element_Text("image_user_name");
$oUserName->setLabel("Nazwa użytkownika:")->setFilters($this->_aFilters);
$oUserName->addValidator(new Zend_Validate_StringLength(array("max" => 50)));
$oUserName->setRequired(TRUE);
$oUserName->setAttrib("class", "valid");
$this->addElement($oUserName);
$oDescription = new Zend_Form_Element_Textarea("image_descr");
$oDescription->setLabel("Opis:")->setFilters($this->_aFilters);
$oDescription->addValidator(new Zend_Validate_StringLength(array("max" => 100)));
$oDescription->setRequired(FALSE);
$oDescription->setAttrib("class", "valid");
$this->addElement($oDescription);
$this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200));
$this->getElement("csrf_token")->removeDecorator("Label");
$oSubmit = $this->createElement("submit", "image_settings_submit");
$oSubmit->setLabel("Zapisz");
$this->addElement($oSubmit);
$oViewScript = new Zend_Form_Decorator_ViewScript();
$oViewScript->setViewModule("admin");
$oViewScript->setViewScript("_forms/_defaultform.phtml");
$this->clearDecorators();
$this->setDecorators(array(array($oViewScript)));
$oElements = $this->getElements();
foreach ($oElements as $oElement) {
$oElement->setFilters($this->_aFilters);
$oElement->removeDecorator("Errors");
}
}
示例13: init
public function init()
{
$this->setMethod('POST');
$this->setName('sendEmailForm');
//$this->setAction('index/view');
$element = new Zend_Form_Element_Hidden('id');
$element->setValue($this->advertisement->id);
$this->addElement($element);
$element = new Zend_Form_Element_Hidden('city');
$element->setValue($this->city);
$this->addElement($element);
$element = new Zend_Form_Element_Text('name');
$element->setLabel('怎么称呼您');
$element->setRequired(true);
$element->setDescription('必填');
$this->addElement($element);
$element = new Zend_Form_Element_Text('email');
$element->setLabel('您的Email');
$element->setRequired(true);
$element->addValidator(new Zend_Validate_EmailAddress());
$element->addFilter(new Zend_Filter_HtmlEntities());
$element->addFilter(new Zend_Filter_StripTags());
$element->addValidator('NotEmpty');
$element->setDescription('必填');
$this->addElement($element);
$element = new Zend_Form_Element_Textarea('body');
$element->setLabel('内容');
$element->setRequired(true);
$element->addValidator('NotEmpty');
$element->setDescription('必填');
$element->setAttrib('rows', 4);
$this->addElement($element);
$element = new Elements();
$element->addReCaptcha($this);
$element = new Zend_Form_Element_Submit('send');
$element->setValue('发送');
$element->removeDecorator('Label');
$this->addElement($element);
}
示例14: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'feedback');
$id = new Zend_Form_Element_Hidden('id');
$title = new Zend_Form_Element_Text('title');
$title->setAttrib('maxLength', 20);
$title->addFilter(new Zend_Filter_StringTrim());
$title->setRequired(true);
$title->addValidator('NotEmpty', false, array('messages' => 'Please enter title.'));
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('size', '40');
//$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '2000');
$description->setRequired(true);
$description->addValidator('NotEmpty', false, array('messages' => 'Please enter description.'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $title, $description, $submit));
}
示例15: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'servicerequest');
$id = new Zend_Form_Element_Hidden('id');
$service_desk_id = new Zend_Form_Element_Hidden('service_desk_id');
$service_desk_conf_id = new Zend_Form_Element_Select('service_desk_conf_id');
$service_desk_conf_id->setLabel("Category");
$service_desk_conf_id->setRequired(true);
$service_desk_conf_id->addValidator('NotEmpty', false, array('messages' => 'Please select category.'));
$service_desk_conf_id->addMultiOptions(array('' => 'Select category'));
$service_desk_conf_id->setRegisterInArrayValidator(false);
$service_request_id = new Zend_Form_Element_Select('service_request_id');
$service_request_id->setLabel("Request Type");
$service_request_id->setRequired(true);
$service_request_id->addValidator('NotEmpty', false, array('messages' => 'Please select request type.'));
$service_request_id->addMultiOptions(array('' => 'Select request'));
$service_request_id->setRegisterInArrayValidator(false);
$priority = new Zend_Form_Element_Select('priority');
$priority->setLabel("Priority");
$priority->setRequired(true);
$priority->addValidator('NotEmpty', false, array('messages' => 'Please select priority.'));
$priority->addMultiOptions(array('' => 'Select priority', '1' => 'Low', '2' => 'Medium', '3' => 'High'));
$priority->setRegisterInArrayValidator(false);
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel("Description");
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setRequired(true);
$description->setAttrib('maxlength', '2000');
$description->addValidator('NotEmpty', false, array('messages' => 'Please enter description.'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $service_desk_conf_id, $service_request_id, $priority, $description, $submit, $service_desk_id));
$this->setElementDecorators(array('ViewHelper'));
}