PHP code example of hypejunction / hypeprototypervalidators

1. Go to this page and download the library: Download hypejunction/hypeprototypervalidators 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/ */

    

hypejunction / hypeprototypervalidators example snippets


	$field = array(
		'type' => 'text',
		'validation_rules' => array(
			'type' => 'alnum',
		),
	);

	$field = array(
		'type' => 'text',
		'validation_rules' => array(
			'type' => 'int',
			'min' => 10,
			'max' => 20,
		),
	);

	$field = array(
		'type' => 'password',
		'validation_rules' => array(
			'type' => 'string',
			'minlength' => 6,
			'maxlength' => 25,
		),
	);

	$field = array(
		'type' => 'text',
		'validation_rules' => array(
			'type' => 'string',
			'contains' => 'hello world',
		),
	);

	$field = array(
		'type' => 'time',
		'validation_rules' => array(
			'type' => 'string',
			'regex' => '^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$',
		),
	);


// Callback for validating user input
elgg_register_plugin_hook_handler('validate:my_rule', 'prototyper', 'my_callback');

// Register the validation rule to make it available in hypePrototyperUI
hypePrototyper()->config->registerValidationRule('my_rule');


echo elgg_view_form('my_prototyped_form', array(
	'enctype' => 'multipart/form-data',
	'data-parsley-validate' => true,
), $vars);
date