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-9'; $renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"'; $renderer->wrappers['control']['description'] = 'span class=help-block'; $renderer->wrappers['control']['errorcontainer'] = 'span class=help-block'; $form->getElementPrototype()->class('form-horizontal'); foreach ($form->getControls() as $control) { $type = $control->getOption('type'); if ($type === 'button') { $control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default'); $usedPrimary = true; } elseif (in_array($type, ['text', 'textarea', 'select'], true)) { $control->getControlPrototype()->addClass('form-control'); } elseif (in_array($type, ['checkbox', 'radio'], true)) { $control->getSeparatorPrototype()->setName('div')->addClass($type); } } } $form = new Form; $form->onRender[] = 'makeBootstrap3'; $form->addGroup('Personal data'); $form->addText('name', 'Your name') ->setRequired('Enter your name'); $form->addRadioList('gender', 'Your gender', [ 'male', 'female', ]); $form->addCheckboxList('colors', 'Favorite colors', [ 'red', 'green', 'blue', ]); $form->addSelect('country', 'Country', [ 'Buranda', 'Qumran', 'Saint Georges Island', ]); $form->addCheckbox('send', 'Ship to address'); $form->addGroup('Your account'); $form->addPassword('password', 'Choose password'); $form->addUpload('avatar', 'Picture'); $form->addTextArea('note', 'Comment'); $form->addGroup(); $form->addSubmit('submit', 'Send'); $form->addSubmit('cancel', 'Cancel'); if ($form->isSuccess()) { echo '

Form was submitted and successfully validated

'; Dumper::dump($form->getValues()); exit; } ?> Nette Forms & Bootstrap v3 rendering example