nette-formslisted
Install: claude install-skill nette/agent-plugins
## Nette Forms
Nette Forms provides secure, reusable forms with automatic validation on both client and server side.
```shell
composer require nette/forms
```
### Forms in Presenters
**Use `Nette\Application\UI\Form`, not `Nette\Forms\Form`.** The former extends the latter and
adds `SignalReceiver`, so it can pick up the submit signal and reach the presenter;
`Nette\Forms\Form` is the standalone variant and will not receive submitted data as a
presenter component.
Forms are created in factory methods named `createComponent<Name>`:
```php
protected function createComponentRegistrationForm(): Form
{
$form = new Form;
$form->addText('name', 'Name:')
->setRequired('Please enter your name.');
$form->addEmail('email', 'Email:')
->setRequired('Please enter your email.');
$form->addPassword('password', 'Password:')
->setRequired('Please enter password.')
->addRule($form::MinLength, 'Password must be at least %d characters', 8);
$form->addSubmit('send', 'Register');
$form->onSuccess[] = $this->registrationFormSucceeded(...);
return $form;
}
private function registrationFormSucceeded(Form $form, \stdClass $data): void
{
// $data->name, $data->email, $data->password
$this->flashMessage('Registration successful.');
$this->redirect('Home:');
}
```
Render in template:
```latte
{control registrationForm}
```
### Create and Edit Pattern
Unified form for both creating and editing records:
```php
class ProductPresenter extends BasePresenter
{
public function