public function testBind()
 {
     $form = new phForm('test', 'simpleTestView');
     $form->bindAndValidate(array('username' => 'test', 'password' => 'pass'));
     $this->assertTrue($form->isValid(), 'form is correctly valid');
     /*
      * change the value of username directly and check
      * that getValue on the form returns the values of
      * its data items and not what was bound to it
      */
     $form->username->bind('new');
     $this->assertEquals(array('username' => 'new', 'password' => 'pass'), $form->getValue(), 'getValue returns correct data');
 }
 * The second argument is the form template to use.
 */
$form = new phForm('register', 'registerForm');
/*
 * set the various validators
 */
$form->fullname->setValidator(new phRequiredValidator());
// note that fullname is the value of the name helper in the form and NOT the id helper
$form->email->setValidator(new phRequiredValidator());
$form->password->setValidator(new phRequiredValidator());
$form->confirmPassword->setValidator(new phCompareValidator($form->password, phCompareValidator::EQUAL));
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    /*
     * data has been posted back, bind it to the form
     */
    $form->bindAndValidate($_POST['register']);
    if ($form->isValid()) {
        /*
         * form data is valid, put your code to
         * register a new user here
         */
        echo "<h1>Registration Complete!</h1>";
    }
}
?>
<form action="/registration/register.php" method="post">
	<?php 
echo $form;
// this will render the form
?>
</form>
 */
$start = new phCompareValidator(strtotime('2011-01-01 00:00:00'), phCompareValidator::GREATER_EQUAL, $errorMessage);
/*
 * setup a validator that says the datetime value given must be less
 * or equal to the end of January 2011
 */
$end = new phCompareValidator(strtotime('2011-01-31 23:59:59'), phCompareValidator::LESS_EQUAL, $errorMessage);
/*
 * combine the start and end validators so the date must be between
 * the two values
 */
$between = new phValidatorLogic($start);
$between->and_($end);
$timeForm->setValidator($between);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $form->bindAndValidate($_POST['event']);
    if ($form->isValid()) {
        /*
         * form data is valid, put your code to
         * register a new user here
         */
        echo "<h1>Thankyou! You chose the date: " . date('r', $form->time->getDateTime()) . "</h1>";
    }
}
?>
<form action="event.php" method="post">
	<?php 
echo $form;
// this will render the form
?>
</form>
$form = new phForm('deliver', 'deliveryForm');
/*
 * create the address form, the first argument
 * needs to match what we have in the form helper
 * on the deliveryForm template
 */
$address = new phForm('address', 'addressForm');
/*
 * add the sub form to the main form
 */
$form->addForm($address);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    /*
     * data has been posted back, bind it to the form
     */
    $form->bindAndValidate($_POST['deliver']);
    if ($form->isValid()) {
        ?>
		<h1>Thanks!</h1>
		<p>We will deliver to 
		<?php 
        echo $form->address->address . ', ' . $form->address->city . ', ' . $form->address->zip;
        ?>
</p>
<?php 
    }
}
?>
<form action="/subform/deliver.php" method="post">
	<?php 
echo $form;