Email address form input for Nette forms.

v1.0.2 2018-07-09 20:57 UTC


Build Status Coverage Status Downloads this Month Latest stable


Via Composer:

$ composer require nepada/email-address-input

Option A: install form container extension method via DI extension

    - Nepada\Bridges\EmailAddressInputDI\EmailAddressInputExtension

It will register extension method addEmailAddress($name, $label) to Nette\Forms\Container.

Option B: use trait in your base form/container class

You can also use TEmailAddressInput trait in your base form/container class to add method addEmailAddress($name, $label).


trait TFormControls

    use Nepada\Bridges\EmailAddressInputForms\TEmailAddressInput;

    public function addContainer($name)
        $control = new Container;
        if ($this->currentGroup !== null) {
        return $this[$name] = $control;


class Container extends Nette\Forms\Container

    use TFormControls;


class Form extends Nette\Forms\Form

    use TFormControls;



EmailAddressInput is form control that uses email address value object to represent its value (see nepada/email-address for further details). It automatically validates the user input and getValue() method always returns EmailAddress instance, or null if the input is not filled.

$emailAddressInput = $form->addEmailAddress('E-mail');
$emailAddressInput->setValue('42'); // InvalidEmailAddressException is thrown
$emailAddressInput->setValue(''); // the value is internally converted to EmailAddress value object
$emailAddressInput->getValue(); // EmailAddress instance for