Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Nette\Application\AppForm;
- class TestPresenter extends Nette\Application\Presenter
- {
- public function renderDefault()
- {
- $this['test']->render();
- }
- protected function createComponentTest()
- {
- $form = new AppForm($this, 'test');
- $form->addText('txt', 'text')
- ->addRule(AppForm::INTEGER, 'Not a number')
- ->addRule(function ($control) {
- return strlen($control->value) > 3;
- }, 'Not long enough');
- $form->addSubmit('s', 'send');
- $form->onSubmit[] = function ($frm) {
- dump($frm->values);
- };
- }
- }
Add Comment
Please, Sign In to add comment