Form factory for nette framework

v1.0.0 2021-02-24 08:36 UTC

This package is auto-updated.

Last update: 2024-11-24 17:06:33 UTC


README

Latest Stable Version Total Downloads Integrity check Latest Unstable Version License

Install

Comoposer command:

composer require mati-core/form

Trait for Presenter

final class *Presenter extends BasePresenter
{
    use FormFactoryTrait; 
}

Using

final class *Presenter extends BasePresenter{
    
    use FormFactoryTrait;
    
    public function createComponentMyForm(): Form
    {
        $form = $this->formFactory->create(); 
        
        $form->addText('myText', 'My text');
        
        $form->onSuccess[] = function (Form $form, ArrayHash $values): void {
            $text = $values->myText;
        };
        
        return $form;
    }
}