|
|
|
|
|
|
Arguments:
Description:
This function walks al fields which are set at that point and checks if they are valid. It returns true if the are all valid and false if one or more fields are invalid.
Example
<?php
// include the class
include("FH3/class.FormHandler.php");
// create new formhandler object
$form = new FormHandler();
/* WRONG ! No fields set! */
if( $form->isCorrect() )
{
// ...
}
// normal textfields
$form->textField("Name", "name", FH_STRING, 20, 50);
$form->textField("Age", "age", FH_INTEGER, 2, 5);
/* CORRECT way of use! There is a form to check! */
// check of the form is posted and if the field(s) are correct
if( $form->isPosted() && !$form->isCorrect() )
{
// clear the fields
$form->setValue("name", "", true);
$form->setValue("age", "", true);
}
// button to submit the form
$form->submitButton();
// set the handler
$form->onCorrect("doRun");
// display the form
$form->flush();
// the data handler
function doRun( $data )
{
echo "Hello ". $data["name"];
}
?>
|
Latest change: 05 March 10 / 08:58
Comments
|
|
|
|