public function parse($tpl)
{
parent::parse($tpl);
$this->validate();
// if the form is submitted but there was an error, assign a general error
if ($this->useGlobalError && $this->isSubmitted() && !$this->isCorrect()) {
$tpl->assign('formError', true);
}
}