<?php
 
require_once '../Kod_Form.php';
 
$form = new Kod_Form("login", 0, "");
 
$fusername =& $form->addElement(new Kod_Field("username", "Username", Kod_Field::text, null, "Please enter username"));
$fusername->addValidator(new Regex_Validator("'\w*'", "Username can hold only numbers and letters"));
$fusername->addValidator(new Size_Validator(10, 4, "Username must be 4 to 10 letters long."));
 
$fpassword =& $form->addElement(new Kod_Field("password", "Password", Kod_Field::password, null, "Please enter password"));
$fpassword->addValidator(new Regex_Validator("'\w*'", "Password can hold only numbers and letters."));
$fpassword->addValidator(new Size_Validator(10, 4, "Password must be 4 to 10 letters long."));
 
$form->addElement(new Kod_Submit("slogin", "Login"));
?>
 
<html>
<head>
<title>Kod_Form_Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php
if($form->isSubmited() && $form->isValid()){
	?>
	<div>You are in. ( Your username: <?php print $form->username->getValue();?>, Your password: <?php print $form->password->getValue();?>)</div>
	<div><a href="">Logout</a></div>
	<?php
}
else
	print $form->display();
 
?>
</body>
</html>