本文整理汇总了PHP中Nette\Application\UI\Form::addTextArea方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addTextArea方法的具体用法?PHP Form::addTextArea怎么用?PHP Form::addTextArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addTextArea方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentPageForm
protected function createComponentPageForm()
{
$form = new Form();
$form->setTranslator($this->translator->domain('pageEditForm'));
$form->getElementPrototype()->id = 'page-form';
$form->addText('title', 'title.label', null, Page::LENGTH_TITLE)->setMaxLength(Page::LENGTH_TITLE)->setRequired('title.messages.required')->setAttribute('data-text-length', Page::LENGTH_TITLE)->addRule(Form::MAX_LENGTH, new Phrase('title.messages.maxLength', ['numChars' => Page::LENGTH_TITLE]), Page::LENGTH_TITLE);
$form->addText('publishedAt', 'publishedAt.label', null, 16)->setHtmlId('datetimepicker')->setRequired('publishedAt.messages.required')->addCondition(Form::FILLED)->addRule(Form::MAX_LENGTH, new Phrase('publishedAt.messages.maxLength', ['numChars' => 16]), 16);
$form->addTextArea('intro', 'intro.label', null, 7)->setMaxLength(Page::LENGTH_INTRO)->setRequired('intro.messages.required')->setAttribute('data-text-length', Page::LENGTH_INTRO)->addRule(Form::MAX_LENGTH, new Phrase('intro.messages.maxLength', ['numChars' => Page::LENGTH_INTRO]), Page::LENGTH_INTRO);
$form->addTextArea('text', 'text.label', null, 25);
//->setRequired('text.messages.required');
$form->addText('url', 'url.label', null, 255);
$form->addSelect('lang', 'lang.label')->setItems($this->availableLocales)->setDefaultValue($this->defaultLocale);
if (isset($this->page)) {
$form['lang']->setDisabled();
//$form['lang']->setOmitted();
}
$form->addCheckbox('allowedComments', 'allowedComments.label')->setDefaultValue(true);
$form->addText('keywords', 'keywords.label');
$form->addText('description', 'description.label');
$form->addSubmit('saveAndPublish', 'saveAndPublish.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAndPublish.title'))->onClick[] = [$this, 'processPageSavingAndPublishing'];
$form->addSubmit('saveAsDraft', 'saveAsDraft.caption')->setAttribute('title', $this->translator->translate('pageEditForm.saveAsDraft.title'))->onClick[] = [$this, 'processPageSavingAsDraft'];
if (!$this->authorizator->isAllowed($this->user, 'page', 'create') or !$this->authorizator->isAllowed($this->user, 'page', 'edit')) {
$form['saveAndPublish']->setDisabled();
$form['saveAsDraft']->setDisabled();
}
$form->addProtection();
return $form;
}
示例2: createComponentArticleForm
protected function createComponentArticleForm()
{
$form = new UI\Form();
$form->addText('name', 'Název článku:')->setRequired();
$form->addUpload('image', 'Obrázek JPG')->addCondition($form::FILLED)->addRule($form::IMAGE, 'Zvolený soubor není obrázek.')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost souboru je 5 MB.', 6 * 1024 * 1024);
$form->addTextArea('annotation', 'Annotace:')->setAttribute('class', 'tinyMCE');
$form->addTextArea('text', 'Článek:')->setAttribute('class', 'tinyMCE');
$form->addSubmit('save', 'Uložit')->setAttribute('class', 'btn btn-primary');
$form->onSuccess[] = array($this, 'articleFormSucceeded');
return $form;
}
示例3: createComponentArticleForm
protected function createComponentArticleForm()
{
$form = new UI\Form();
$form->addText('name', 'Název článku:')->setRequired();
$form->addText('menu', 'Položka menu:');
$form->addText('url', 'Odkaz jinam než na svůj')->setType('url');
$form->addTextArea('annotation', 'Annotace:')->setAttribute('class', 'tinyMCE');
$form->addTextArea('text', 'Článek:')->setAttribute('class', 'tinyMCE');
$form->addSubmit('save', 'Uložit')->setAttribute('class', 'btn btn-primary');
$form->onSuccess[] = array($this, 'articleFormSucceeded');
return $form;
}
示例4: create
public function create()
{
$form = new Form();
$form->enableLocalized();
$form->addText('name')->setRequired('errors.fill_role_name')->setAttribute('class', 'form-control')->setAttribute('placeholder', 'role_name');
$form->addTextArea('access', 'role_access')->setAttribute('class', 'form-control');
$form->addTextArea('description', 'description')->setAttribute('class', 'form-control');
$form->addTextArea('access_ban', 'access_ban')->setAttribute('class', 'form-control');
$form->addSubmit('submit', 'add')->setAttribute('class', 'btn btn-primary btn-purple btn-flat');
$form->onSuccess[] = $this->success_form_add;
return $form;
}
示例5: createComponentForm
/**
* @return Form
*/
public function createComponentForm()
{
$form = new Form();
$form->addText('name', 'Name:', null, 45)->setRequired('Please fill your name or nick name.')->setValue('Anonymous');
$form->addTextArea('pros', 'Pros:', null, 5);
$form->addTextArea('cons', 'Cons:', null, 5);
$form['pros']->addConditionOn($form['cons'], Form::BLANK, TRUE)->setRequired('Please fill at least Pros or Cons.');
$form['cons']->addConditionOn($form['pros'], Form::BLANK, TRUE)->setRequired('Please fill at least Pros or Cons.');
$form->addRadioList('rating', 'Rating:', [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5])->setRequired('Please select your rating');
$form->addSubmit('send', 'Save Rating');
$form->onSuccess[] = array($this, 'formSucceeded');
return $form;
}
示例6: create
/**
* @return \Nette\Application\UI\Form
*/
public function create()
{
$form = new Form();
$form->addGroup($this->performance ? "Upravit představení" : "Přidat představení");
$form->addTextArea("songAuthor", "Autor skladby:")->setRequired("Vyplňte prosím autora skladby");
$form->addTextArea("songName", "Jméno skladby:")->setRequired("Vyplňte prosím jméno skladby");
$form->addTextArea("note", "Poznámka:");
$form->addSubmit("send", $this->performance ? "Upravit představení" : "Přidat představení");
$form->onSuccess[] = $this->processForm;
if ($this->performance) {
$form->setDefaults(["songAuthor" => $this->performance->songAuthor, "songName" => $this->performance->songName, "note" => $this->performance->note]);
}
return $form;
}
示例7: createComponentClanek
protected function createComponentClanek()
{
$form = new Form();
$form->addHidden("id");
$form->addText("titulek", "Titulek")->addRule(Form::MAX_LENGTH, "Titulek je příliš dlouhý", 64);
$form->addText("autor", "Autor")->addRule(Form::MAX_LENGTH, "Autor je příliš dlouhý", 64);
$form->addSelect("kategorie_id", "Kategorie", $this->kategorie->getPairs());
$form->addTextArea("perex", "Perex");
$form->addSelect("obrazek_id", "Obrázek", $this->upload->getPairs())->setPrompt("-- bez obrázku --");
$form->addTextArea("text", "Text");
$form->addTextArea("stitky_text", "Štítky");
$form->addText("skupina", "Skupina");
$form->addSubmit("save", "Uložit");
$form->onSuccess[] = $this->saveClanek;
return $form;
}
示例8: createComponentAddInterpret
protected function createComponentAddInterpret()
{
$form = new Form();
$form->addText('nazev', 'Název interpreta')->setRequired('Je třeba zadat jméno interpreta.');
$form->addSelect('interpret_id', 'Alias pro', $this->interpreti->findAll()->order('nazev')->fetchPairs('id', 'nazev'))->setPrompt('Vyberte alias');
$form->addTextArea('desc', 'About');
$form->addHidden('id');
$form->addSubmit('send', 'Přidat');
$form->onSuccess[] = function ($frm) {
$values = $frm->values;
if ($values->id) {
$this->interpreti->find($values->id)->update($values);
$this->logger->log('Interpret', 'edit', "%user% upravila(a) interpreta {$values->nazev}");
$msg = $this->flashMessage("Interpret '{$values->nazev}' editován.", 'success');
$msg->title = 'A je tam!';
$msg->icon = 'check';
} else {
$r = $this->interpreti->add($values->nazev, $values->desc, $values->interpret_id, $this->user);
$this->logger->log('Interpret', 'create', "%user% vytvořila(a) interpreta {$values->nazev}");
$msg = $this->flashMessage("Interpret '{$values->nazev}' přidán.", 'success');
$msg->title = 'A je tam!';
$msg->icon = 'check';
$msg->html = Html::el('a')->setText('Přidat další')->setHref($this->link('editor'));
if ($this->action == 'editor') {
$this->redirect('this', [$r->id]);
}
}
$this->redirect('this');
};
return $form;
}
示例9: create
/**
* @return Form
*/
public function create($otherUser = '', $privilegesEdit = false)
{
$form = new Form();
if (!empty($otherUser)) {
$user = $otherUser;
$form->addHidden('id', $otherUser->id);
} else {
$user = $this->user;
}
$form->addUpload('photo', 'Fotka')->addRule($form::MAX_FILE_SIZE, 'Maximální velikost fotky je 10MB', 80000000);
$form->addText('nickName', 'Přihlašovací jméno')->setValue($user->nickName)->setOption('description', Html::el('p')->setHtml('Pokud chcete můžete pro jednodušší přihlašování zadat jméno'))->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Jméno musí mít alespoň %d znaky', 3);
$form->addText('name', 'Jméno k zobrazení')->setValue($user->name);
if ($privilegesEdit) {
$form->addText('title', 'Titul')->setValue($user->title)->setOption('description', Html::el('p')->setHtml('Titul měnitelný administrátorem přidaný před jméno'));
}
$date = $this->parseDateForm();
$form->addSelect('day', 'Den narození', $date['days'])->setValue($date['day']);
$form->addSelect('month', 'Měsíc narození', $date['months'])->setValue($date['month']);
$form->addSelect('year', 'Rok narození', $date['years'])->setValue($date['year']);
$form->addSelect('gender', 'Pohlaví', ['ma' => 'Muž', 'fe' => 'Žena', 'no' => 'Neuvedeno'])->setValue($user->gender);
$form->addCheckbox('wall', 'Povolit zeď')->setValue($user->wall == 1 ? true : false);
$form->addCheckbox('mailList', 'Posílat od nás maily')->setValue($user->mailList == 1 ? true : false);
$form->addTextArea('about', 'O mě')->setValue($user->about);
if ($privilegesEdit) {
$this->editPrivileges($form, $user->permissions);
}
$form->addSubmit('submit', 'Uložit');
$form->addProtection('Vypršel časový limit, odešlete formulář znovu');
$form->onSuccess[] = [$this, 'formSucceeded'];
return $form;
}
示例10: createComponentUserEditor
protected function createComponentUserEditor()
{
$form = new Form();
$form->addText('username', 'Uživatelské jméno')->setRequired('Zadejte uživatelské jméno');
$form->addText('realname', 'Skutečné jméno');
$form->addSelect('role', 'Role', $this->perms->getRoles())->setPrompt('Vyberte roli')->setRequired('Musíte vybrat roli uživatele');
$form->addText('email', 'Email')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Zadejte platnnou emailovou adresu');
$form->addPassword('password', 'Heslo')->addCondition(Form::FILLED)->addRule(Form::MIN_LENGTH, 'Heslo musí mít minimálně %s znaků', 6);
$form->addPassword('password_verify', 'Ověření hesla')->setOmitted()->addConditionOn($form['password'], Form::FILLED)->addRule(Form::EQUAL, 'Hesla se neshodují', $form['password']);
$form->addText('twitter_acc', 'Twitter');
$form->addText('www', 'Homepage (WWW)')->addCondition(Form::FILLED)->addRule(Form::URL, 'Zadejte platnou URL');
$form->addTextArea('about', 'Krátce o uživateli');
$form->addHidden('id')->setRequired('Vyžadován identifikátor');
$form->onSuccess[] = function (Form $f) {
$val = $f->values;
if (empty($val->password)) {
unset($val->password);
} else {
$this->users->changePassword($val->id, $val->password);
unset($val->password);
}
$this->users->update($val->id, $val);
$this->logger->log('User', 'edit', "%user% editoval(a) profil uživatele {$val->username}");
$msg = $this->flashMessage("Profil uživatele '{$val->username}' upraven.", 'success');
$msg->title = 'A je tam!';
$msg->icon = 'check';
$this->redirect('this');
};
$form->addSubmit('send', 'Uložit');
return $form;
}
示例11: createComponentRaceForm
public function createComponentRaceForm()
{
$validator = function ($item) {
return $this->race->freeRaceid($item->value);
};
$form = new Form();
$i = $form->addText('raceid', 'ID závodu:');
if ($this->getAction() == 'add') {
$i->setRequired('ID závodu je povinné')->addRule(Form::LENGTH, 'Délka ID musí být 4 - 8 znaků', array(4, 8))->addRule($validator, 'ID je již použito.');
} else {
$i->setDisabled(TRUE);
}
$form->addText('name', 'Název:');
$form->addDateTimePicker('datetime_0', 'Datum a čas:')->setRequired('Datum a čas jsou povinné.');
$form->addSelect('type', 'Typ závodu', self::$race_type);
$form->addSelect('opt_preftype', 'Druh závodu', self::$race_kind);
$form->addSelect('opt_incomplete', 'Při chybějící kontrole', self::$inco_list);
$form->addCheckbox('opt_autocat', 'Automatická kategorie');
$form->addCheckbox('opt_namefrsi', 'Doplnit jméno z SI čipu');
$form->addCheckbox('opt_addnew', 'Hodnotit i nepřihlášené');
$form->addTextArea('descr', 'Popis:');
$form->addSubmit('send', 'OK');
$form->addSubmit('cancel', 'Zpět')->setValidationScope(false)->onClick[] = [$this, 'formCancelled'];
if ($this->getAction() == 'add') {
$form->onSuccess[] = [$this, 'addRaceFormSucceeded'];
} else {
$form->onSuccess[] = [$this, 'editRaceFormSucceeded'];
}
$form->setRenderer(new Bs3FormRenderer());
return $form;
}
示例12: createComponentCourseRegistration
protected function createComponentCourseRegistration()
{
$msgNameReq = "Zadejte prosím jméno a příjmení.";
$msgEmailReq = "Zadejte prosím emailovou adresu.";
$msgPhoneReq = "Zadejte prosím telefonní číslo.";
$msgPhoneBad = "Telefon není správně vyplněn.";
$msgDateReq = "Vyberte prosím termín akce.";
$persons = array('1 osoba', '2 osoby', '3 osoby', '4 osoby', '5 osob');
$dates = array();
foreach ($this->context->parameters['courses'][$this->course]['dates'] as $date) {
$dates[] = $this->template->date($date['date'], '%d.%m.%Y');
}
$form = new Form();
$form->addText('name', 'Jméno', NULL, 60)->setAttribute('placeholder', 'Jméno a příjmení')->setAttribute('tabindex', 1)->addRule(~$form::EQUAL, $msgNameReq, $form['name']->control->attrs['placeholder'])->setRequired($msgNameReq);
$form->addText('email', 'Email', NULL, 40)->setAttribute('placeholder', 'Email')->setAttribute('tabindex', 2)->addRule(~$form::EQUAL, $msgEmailReq, $form['email']->control->attrs['placeholder'])->setRequired($msgEmailReq)->addRule(Form::EMAIL, '%label není správně vyplněn.');
$form->addText('phone', 'Telefon', NULL, 9)->setAttribute('placeholder', 'Telefon')->setAttribute('tabindex', 3)->addRule(~$form::EQUAL, $msgPhoneReq, $form['phone']->control->attrs['placeholder'])->setRequired($msgPhoneReq)->addRule(Form::INTEGER, $msgPhoneBad)->addRule(Form::LENGTH, $msgPhoneBad, 9);
$form->addSelect('date', 'Termín konání')->setPrompt('Zvolte termín konání')->setItems($dates)->setRequired($msgDateReq);
if (count($dates) == 1) {
$form['date']->setDefaultValue(0);
}
$form->addSelect('person', 'Počet')->setItems($persons, FALSE);
$form->addTextArea('note', 'Poznámka', NULL)->setAttribute('placeholder', 'Jakýkoli dotaz nebo zpráva.')->setAttribute('tabindex', 4)->addRule(Form::MAX_LENGTH, 'Poznámka může obsahovat maximálně 1000 znaků.', 1000);
$form->addSubmit('send', 'Odeslat')->setAttribute('tabindex', 5)->setAttribute('class', 'button');
$form->addSubmit('storno', 'Storno')->setAttribute('tabindex', 6)->setValidationScope(NULL)->setAttribute('class', 'button');
$form->addHidden('spamtest')->addRule($form::EQUAL, 'Robot', array(NULL));
$form->onSuccess[] = callback($this, 'submitRegistration');
return $form;
}
示例13: createComponentPageEditor
protected function createComponentPageEditor()
{
$form = new Form();
$form->addText('name', 'Název stránky')->setRequired();
$form->addText('heading', 'Nadpis')->setRequired();
$form->addTextArea('body', 'Obsah');
$form->addCheckbox('hidden', 'Výstřižek stránky');
$form->addHidden('id');
$form->addSubmit('send', 'Uložit');
$form->onSuccess[] = function (Form $f) {
$val = $f->values;
//Update page
if ($val->id) {
$this->pages->find($val->id)->update($val);
$msg = $this->flashMessage("Stránka byla upravena", 'success');
$msg->title = 'A je tam!';
$msg->icon = 'check';
$this->logger->log('CMS', 'edit', "%user% uprvila(a) stránku {$val->name}");
} else {
$r = $this->pages->create($val);
$msg = $this->flashMessage("Stránka byla vytvořena.", 'success');
$msg->title = 'A je tam!';
$msg->icon = 'check';
$this->redirect('this', ['id' => $r->id]);
$this->logger->log('CMS', 'create', "%user% vytvořil(a) stránku {$val->name}");
}
$this->redirect('this');
};
return $form;
}
示例14: createComponentCommentForm
protected function createComponentCommentForm()
{
$form = new Form();
$form->addTextArea('message');
$form->addSubmit('send', 'Send');
$form->onSuccess[] = $this->processCommentForm;
return $form;
}
示例15: create
/**
* @return Form
*/
public function create()
{
$form = new Form($this->parent, "contactForm");
$form->addText("email", "E-mail")->setType("email")->addRule(Form::REQUIRED, "Vyplňte prosím Váš e-mail.")->addRule(Form::EMAIL, "Vyplňte prosím Váš e-mail.");
$form->addTextArea("content", "Text")->addRule(Form::REQUIRED, "Vyplňte prosím text.");
$form->addSubmit("send", "Odeslat")->setAttribute("class", "btn btn-primary");
return $form;
}