PHP code example of mvccore / ext-form-validator-special

1. Go to this page and download the library: Download mvccore/ext-form-validator-special 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/ */

    

mvccore / ext-form-validator-special example snippets


$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);