Statistics
68
11
0
2.7y
Badges
Tags
forms
Dependencies

Phone number control for Nette Framework

Build Status SensioLabsInsight Status Latest Stable Version Composer Downloads Dependency Status HHVM Status

Installation

composer require nella/forms-phone

Usage


$form = new \Nette\Forms\Form;
$form->addComponent(new \Nella\Forms\Phone\PhoneNumberInput('Phone'), 'phone');

// or

\Nella\Forms\Phone\PhoneNumberInput::register();
$form->addPhone('phone', 'Phone');

// Optional phone number validation
$form['phone']
	->addCondition(\Nette\Application\UI\Form::FILLED)
		->addRule([$form['phone'], 'validatePhoneNumber'], 'Phone number is invalid');
		
// Optional phone number default prefix
$control = $form->addPhone('phone', 'Phone');
$control->setDefaultPrefix('+420');

Manual rendering

{form myForm}
	{label phone /}
	{input phone:prefix}
	{input phone:number}
{/form}

License

Phone number control for Nette Framework is licensed under the MIT License - see the LICENSE file for details

  • v1.1.0 v1.1.0

    added support for default prefix

  • v1.0.2 PhoneNumberInput

    Rename PhoneNumber to PhoneNumberInput

  • v1.0.0 nette/forms

    require just nette/forms (2.2+)

  • v0.9.5 Nette 2.2

    • added support for Nette 2.2
    • added register method
    • tests / travis improvements

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com