Exemplo n.º 1
0
 */
error_reporting(E_ALL);
ini_set('display_errors', '1');
/**
 * Get Reform's class loader
 */
require_once '../reform/ClassLoader.php';
Reform\ClassLoader::register();
// faster than generic autoloaders
use Reform\Reform;
use Reform\ValidationRule\Required;
use Reform\ValidationRule\Matches;
/**
 * EXAMPLE FORM
 */
$form = Reform::form('')->append(array(Reform::input('name')->setAttribute('id', 'name')->addRule(new Required()), Reform::email('email')->addRule(new Required()), $password1 = Reform::password('password1')->addRule(new Required()), Reform::password('password2')->addRule(new Matches($password1)), Reform::select('account_type', array(Reform::option('Tier 1', 1), Reform::option('Tier 2', 2), Reform::option('Tier 3', 3), Reform::option('Tier 4', 4))), Reform::submit('', 'Sign up')));
// run validation
!empty($_POST) && $form->runValidation();
//echo '<pre>'; print_r($form); echo '</pre>'; die();
?>
<style>
	body {
		color: #444;
		font: 14px Arial;
	}
	form {
		width: 250px;
	}

	label {
		display: block;