mvccore / ext-form-validator-special
MvcCore - Extension - Form - Validator - Special - form special text and numeric validators - company ID (EU), company VAT ID (EU), credit card, hexadecimal number, IBAN bank account number, IP address and ZIP code.
Package info
github.com/mvccore/ext-form-validator-special
pkg:composer/mvccore/ext-form-validator-special
v5.3.0
2024-11-21 15:01 UTC
Requires
- php: >=5.4.0
- mvccore/ext-form: ^5.3
- mvccore/mvccore: ^5.3
Requires (Dev)
None
Suggests
- mvccore/ext-form-field-numeric: MvcCore form extension with input field types number and range.
- mvccore/ext-form-field-text: MvcCore form extension with input field types text, email, password, search, tel, url and textarea field.
Provides
None
Conflicts
None
Replaces
None
README
MvcCore form extension with special text and numeric validators - company ID (EU), company VAT ID (EU), credit card, hexadecimal number, IBAN bank account number, IP address and ZIP code.
Installation
composer require mvccore/ext-form-validator-special
Basic Example
$form = (new \MvcCore\Ext\Form($controller)) ->SetId('demo') ->SetLocale('DE'); // for ZIP validator ... $yourCreditCard = new \MvcCore\Ext\Forms\Fields\Number(); $yourCreditCard ->SetName('your_credit_card') ->SetLabel('Your Credit Card Number:') ->SetValidators( (new \MvcCore\Ext\Forms\Validators\CreditCard) -> SetAllowedTypes( \MvcCore\Ext\Forms\Validators\CreditCard::AMERICAN_EXPRESS, \MvcCore\Ext\Forms\Validators\CreditCard::DISCOVER, \MvcCore\Ext\Forms\Validators\CreditCard::MAESTRO, \MvcCore\Ext\Forms\Validators\CreditCard::MASTERCARD, \MvcCore\Ext\Forms\Validators\CreditCard::VISA ) ); $yourIp = new \MvcCore\Ext\Forms\Fields\Text([ 'name' => 'your_ip', 'label' => 'Your IP Address:', 'validators' => [ new \MvcCore\Ext\Forms\Validators\Ip([ 'allowIPv4HexFormat' => FALSE, 'allowIPv4BinaryFormat' => FALSE, 'allowIPv6Literals' => TRUE, ]) ], ]); $yourZipCode = new \MvcCore\Ext\Forms\Fields\Text([ 'name' => 'your_zip_code', 'label' => 'Your ZIP code:', 'validators' => ['ZipCode'], ]); ... $form->AddFields($yourCreditCard, $yourIp, $yourZipCode);