Created
June 12, 2010 00:58
-
-
Save Majkl578/435264 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment