本文整理汇总了PHP中Nette\Application\UI\Form::AddText方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::AddText方法的具体用法?PHP Form::AddText怎么用?PHP Form::AddText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::AddText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/** @return Form */
public function create()
{
$f = new Form();
$f->addText('name', 'Jméno:');
//->setRequired();
$f->addText('surname', 'Příjmení:');
//->setRequired();
$f->addText('institution', 'Pracoviště:');
$f->addText('project', 'Projekt:');
$f->AddText('www', 'web:');
$f->addText('date', 'Datum setkání:')->setAttribute('placeholder', 'rrrr-mm-dd');
$f->addTextArea('note', 'Poznámka')->setAttribute('rows', '10');
$f->addMultiUpload('img', 'Vizitka');
$f->addUpload('foto', 'Foto:');
$f->addSubmit('submit', 'Uložit');
// setup form rendering
$renderer = $f->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['pair']['container'] = 'div class=form-group';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['container'] = 'div class=col-sm-8';
$renderer->wrappers['label']['container'] = 'div class="col-sm-2 control-label"';
$renderer->wrappers['control']['description'] = 'span class=help-block';
$renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
$f->getElementPrototype()->class('form-horizontal');
foreach ($f->getControls() as $control) {
if ($control instanceof Controls\Button) {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-success' : 'btn btn-default');
$usedPrimary = TRUE;
} elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
$control->getControlPrototype()->addClass('form-control');
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
$control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
}
}
return $f;
}