In PFBC, PHP validation is achieved in a two step process. The first step is to apply validation rules to form elements via the element's validation property. Some elements including Captcha, Color, Date, Email, jQueryUIDate, Month, Number, Url, and Week have validation rules applied by default.

Secondly, you need to call the Form class' isValid static method once the form's data has been submitted. This function will return true/false. If false is returned, it indicates that one or more errors occurred. You will then need to redirect users back to the form to correct and resubmit. Here's an example of the isValid method.

<?php
//----------AFTER THE FORM HAS BEEN SUBMITTED----------
use PFBC\Form;

include("PFBC/Form.php");
if(Form::isValid("<replace with unique form identifier>")) {
    /*The form's submitted data has been validated.  Your script can now proceed with any 
    further processing required.*/
}
else {
    header("Location: <replace with form url>");
    /*Validation errors have been found.  We now need to redirect back to the 
    script where your form exists so the errors can be corrected and the form
    re-submitted.*/
}
<?php
//----------AFTER THE FORM HAS BEEN SUBMITTED----------
include("PFBC/Form.php");
if(Form::isValid("<replace with unique form identifier>")) {
    /*The form's submitted data has been validated.  Your script can now proceed with any 
    further processing required.*/
}
else {
    header("Location: <replace with form url>");
    /*Validation errors have been found.  We now need to redirect back to the 
    script where your form exists so the errors can be corrected and the form
    re-submitted.*/
}

PFBC supports 8 types of validation rules: AlphaNumeric, Captcha, Date, Email, Numeric, RegExp, Required, and Url. Here's how they are applied to elements.