本文整理匯總了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;
}