PHP code example of nella / forms-phone
1. Go to this page and download the library: Download nella/forms-phone library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nella / forms-phone example snippets
$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');