当前位置: 首页>>代码示例>>PHP>>正文


PHP Textarea::addValidator方法代码示例

本文整理汇总了PHP中Textarea::addValidator方法的典型用法代码示例。如果您正苦于以下问题:PHP Textarea::addValidator方法的具体用法?PHP Textarea::addValidator怎么用?PHP Textarea::addValidator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Textarea的用法示例。


在下文中一共展示了Textarea::addValidator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct('config-form');
     $lang = OW::getLanguage();
     $months = new Textarea('months');
     $months->setRequired(true);
     $months->addValidator(new IntValidator(1, 12));
     $months->setLabel($lang->text('ocsguests', 'store_period'));
     $this->addElement($months);
     $submit = new Submit('save');
     $submit->setLabel($lang->text('skapi', 'save'));
     $this->addElement($submit);
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:13,代码来源:admin.php

示例2: initialize

 /**
  * Initializes backend form of pages
  */
 public function initialize()
 {
     $lang = new Select('lang', $this->di->get('config')->application->langs->toArray());
     $lang->setLabel('Language');
     $this->add($lang);
     $title = new Text('title');
     $title->setLabel('Title');
     $title->addValidator(new PresenceOf());
     $title->setAttribute('placeholder', 'Title');
     $this->add($title);
     $content = new Textarea('content');
     $content->setLabel('Content');
     $content->addValidator(new PresenceOf());
     $content->setAttribute('placeholder', 'content');
     $this->add($content);
 }
开发者ID:maniolek,项目名称:demo,代码行数:19,代码来源:Article.php

示例3: initialize

 public function initialize($entity = null)
 {
     // In edit page the id is hidden
     if (!is_null($entity)) {
         $this->add(new Hidden('id'));
     }
     //content
     $content = new Textarea('content', array('placeholder' => t('Please be sure to answer the question. Provide details and share your research!'), 'class' => 'wmd-input', 'id' => 'wmd-input', 'required' => true, 'rows' => 8));
     $content->addValidator(new PresenceOf(array('message' => t('content is required.'))));
     $this->add($content);
     $this->add(new Hidden('idObject'));
     $this->add(new Hidden('object'));
     $csrf = new Hidden('csrf');
     $csrf->addValidator(new Identical(array('value' => $this->security->getSessionToken(), 'message' => t('CSRF validation failed'))));
     $this->add($csrf);
     //Submit
     $this->add(new Submit('postAnswer', ['value' => t('Post Your Answer'), 'class' => 'btn btn-sm btn-info']));
 }
开发者ID:SidRoberts,项目名称:phanbook,代码行数:18,代码来源:ReplyForm.php

示例4: generateEditGroupForm

 /**
  * Generates edit group form
  * 
  * @param string $action
  * @return Form
  */
 private function generateEditGroupForm($action)
 {
     $form = new Form('edit-group-form');
     $form->setAction($action);
     $lang = OW::getLanguage();
     $groupName = new TextField('group-name');
     $groupName->setRequired(true);
     $sValidator = new StringValidator(1, 255);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255)));
     $groupName->addValidator($sValidator);
     $form->addElement($groupName);
     $description = new Textarea('description');
     $description->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000)));
     $description->addValidator($sValidator);
     $form->addElement($description);
     $groupId = new HiddenField('group-id');
     $groupId->setRequired(true);
     $form->addElement($groupId);
     $isPrivate = new CheckboxField('is-private');
     $form->addElement($isPrivate);
     $roles = new CheckboxGroup('roles');
     $authService = BOL_AuthorizationService::getInstance();
     $roleList = $authService->getRoleList();
     $options = array();
     foreach ($roleList as $role) {
         $options[$role->id] = $authService->getRoleLabel($role->name);
     }
     $roles->addOptions($options);
     $roles->setColumnCount(2);
     $form->addElement($roles);
     $submit = new Submit('save');
     $submit->setValue($lang->text('forum', 'edit_group_btn'));
     $form->addElement($submit);
     $form->setAjax(true);
     return $form;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:44,代码来源:customize.php

示例5: userInput

 public function userInput()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $settingsForm = new Form('input_settings');
     $userCustomHtml = new CheckboxField('user_custom_html');
     $userCustomHtml->setLabel($language->text('admin', 'input_settings_user_custom_html_disable_label'));
     $userCustomHtml->setDescription($language->text('admin', 'input_settings_user_custom_html_disable_desc'));
     $settingsForm->addElement($userCustomHtml);
     $userRichMedia = new CheckboxField('user_rich_media');
     $userRichMedia->setLabel($language->text('admin', 'input_settings_user_rich_media_disable_label'));
     $userRichMedia->setDescription($language->text('admin', 'input_settings_user_rich_media_disable_desc'));
     $settingsForm->addElement($userRichMedia);
     $commentsRichMedia = new CheckboxField('comments_rich_media');
     $commentsRichMedia->setLabel($language->text('admin', 'input_settings_comments_rich_media_disable_label'));
     $commentsRichMedia->setDescription($language->text('admin', 'input_settings_comments_rich_media_disable_desc'));
     $settingsForm->addElement($commentsRichMedia);
     $maxUploadMaxFilesize = BOL_FileService::getInstance()->getUploadMaxFilesize();
     $this->assign('maxUploadMaxFilesize', $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator = new FloatValidator(0, $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $maxUploadSize = new TextField('max_upload_size');
     $maxUploadSize->setLabel($language->text('admin', 'input_settings_max_upload_size_label'));
     $maxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $settingsForm->addElement($maxUploadSize);
     $resourceList = new Textarea('resource_list');
     $resourceList->setLabel($language->text('admin', 'input_settings_resource_list_label'));
     $resourceList->setDescription($language->text('admin', 'input_settings_resource_list_desc'));
     $settingsForm->addElement($resourceList);
     $attchMaxUploadSize = new TextField('attch_max_upload_size');
     $attchMaxUploadSize->setLabel($language->text('admin', 'input_settings_attch_max_upload_size_label'));
     $attchMaxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $settingsForm->addElement($attchMaxUploadSize);
     $attchExtList = new Textarea('attch_ext_list');
     $attchExtList->setLabel($language->text('admin', 'input_settings_attch_ext_list_label'));
     $attchExtList->setDescription($language->text('admin', 'input_settings_attch_ext_list_desc'));
     $attchExtList->addValidator(new FileExtensionValidator());
     $settingsForm->addElement($attchExtList);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             $config->saveConfig('base', 'tf_comments_rich_media_disable', (int) $data['comments_rich_media']);
             $config->saveConfig('base', 'tf_user_custom_html_disable', (int) $data['user_custom_html']);
             $config->saveConfig('base', 'tf_user_rich_media_disable', (int) $data['user_rich_media']);
             $config->saveConfig('base', 'tf_max_pic_size', round((double) $data['max_upload_size'], 2));
             $config->saveConfig('base', 'attch_file_max_size_mb', round((double) $data['attch_max_upload_size'], 2));
             if (!empty($data['resource_list'])) {
                 $res = array_unique(preg_split('/' . PHP_EOL . '/', $data['resource_list']));
                 $config->saveConfig('base', 'tf_resource_list', json_encode(array_map('trim', $res)));
             }
             $extList = array();
             if (!empty($data['attch_ext_list'])) {
                 $extList = array_unique(preg_split('/' . PHP_EOL . '/', $data['attch_ext_list']));
             }
             $config->saveConfig('base', 'attch_ext_list', json_encode(array_map('trim', $extList)));
             OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
             $this->redirect();
         } else {
             OW::getFeedback()->error($language->text('admin', 'settings_submit_error_message'));
         }
     }
     $userCustomHtml->setValue($config->getValue('base', 'tf_user_custom_html_disable'));
     $userRichMedia->setValue($config->getValue('base', 'tf_user_rich_media_disable'));
     $commentsRichMedia->setValue($config->getValue('base', 'tf_comments_rich_media_disable'));
     $maxUploadSize->setValue(round((double) $config->getValue('base', 'tf_max_pic_size'), 2));
     $resourceList->setValue(implode(PHP_EOL, json_decode($config->getValue('base', 'tf_resource_list'))));
     $attchMaxUploadSize->setValue(round((double) $config->getValue('base', 'attch_file_max_size_mb'), 2));
     $attchExtList->setValue(implode(PHP_EOL, json_decode($config->getValue('base', 'attch_ext_list'))));
     OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_user_input_settings'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:75,代码来源:settings.php


注:本文中的Textarea::addValidator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。