I'm using PFBC with validations and when I initially load the form and submit it, it's fine. However, if I then go back to the form and try it again, it displays errors as soon as the form loads (i.e. before I've tried submitting anything).
session_start();
use PFBC\Form;
use PFBC\Element;
use PFBC\Validation;
include("../../PFBC/Form.php");
if(Form::isValid("webform", true)) {
print "form ok";
Form::clearValues("webform");
}
else {
header("redirecturl.php");
}
$form = new Form("webform");
$form->configure(array(
"prevent" => array("bootstrap")
));
$form->addElement(new Element\Textbox("Name:", "name", array("required" => 1, "size" => 40)));
$form->addElement(new Element\Email("E-mail:", "email", array("required" => 1, "size" => 40)));
$form->addElement(new Element\Textarea("Problem:", "problem", array("required" => 1, "style" => "width: 400px; height: 200px;")));
$form->addElement(new Element\Button("Submit Form", "submit", array("id" => "submit")));
$form->render();