Exemplo n.º 1
0
    $input->post('name')->validate('minlength', 5)->post('age')->validate('greaterthan', 24);
    $input->submit();
} catch (Exception $e) {
    print_r($input->fetchErrors());
}
try {
    $input = new jream\Input(array('name' => 'Jesse', 'age' => 25, 'gender' => 'm'));
    $input->post('name')->validate('maxlength', 4)->error('This is a custom error message')->post('age')->validate('agemin', 12)->post('gender')->validate('eq', 'f');
    $input->submit();
} catch (Exception $e) {
    print_r($input->fetchErrors());
}
echo '<hr />';
// For some JS money money money...
try {
    $input = new jream\Input(array('name' => 'Jesse', 'age' => 25, 'gender' => 'm'));
    $input->post('name')->validate('maxlength', 4)->error('This is a custom error message')->post('age')->validate('eq', 12)->post('gender')->validate('eq', 'f');
    $input->submit();
} catch (Exception $e) {
    print_r($input->fetchErrors());
}
?>



</div>
<!-- end:Wrap -->

<footer>
	(C) 2011 - 2012 Jesse Boyer &lt;http://jream.com&gt;
</footer>
Exemplo n.º 2
0
<h1>Input Example</h1>
<?php 
/**
 * @author		Jesse Boyer <*****@*****.**>
 * @copyright	Copyright (C), 2011-12 Jesse Boyer
 * @license		GNU General Public License 3 (http://www.gnu.org/licenses/)
 *				Refer to the LICENSE file distributed within the package.
 *
 * @link		http://jream.com
 */
require_once '../jream/autoload.php';
new jream\Autoload('../jream/');
if (isset($_REQUEST['run'])) {
    echo '<pre>';
    try {
        $input = new jream\Input();
        $input->post('name')->get('hello')->request('hideme')->post('agree', 'checkbox')->post('box')->validate('length', array(1, 25));
        $input->submit();
        print_r($input->fetch());
    } catch (Exception $e) {
        print_r($input->fetchErrors());
    }
    echo '</pre>';
}
?>

<form action="?run&hello=yes" method="post">
	<input type="text" name="name" value="Jesse" />
	<input type="checkbox" name="agree" />
	<input type="hidden" name="hideme" value="This is a hidden request grabbed!" />
	<input type="text" name="box" />