This isn't a nice form builder to work with, but here is how I managed to create the validation for the tag element.
Add a textbox element:
$form->addTextbox('Tags:', 'tags', "", array("required" => 1));
There is a method "bind([form object], [javascript condition], [php condition])", I think this method is to add a validation rule to an element.
$form->bind($form, '', 'validateTags()');
The third parameter is a function to validate the tag value. return true if the textbox contains correct data, or false if it's incorrect. Also, if the value is incorrect add an error message to the form error session and then return false.
function validateTags($form) {
if (isset($_POST["tag"])) {
$value = strip_tags($_POST["tag"]);
$tags = explode(',', $value);
foreach ($tags as $tag) {
if (strlen($tag) < 3) {
// there might be a better way to do this!
// validation_2 == id of the form
$_SESSION["pfbc-errors"]['validation_2']["errormsg"]['tag'] = "validation message....";
return false;
}
}
unset($_SESSION["pfbc-errors"]['validation_2']["errormsg"]['tag']);
}
return true;
}
Hope this helps