/** * Custom validator for this form * No validation is provided by the Form Class, * that's for the user to define using whatever validation methods they want within this method * @param $fieldName * @param $value * @return bool */ public function validate($fieldName, $value) { if ($fieldName == 'name' && empty($value)) { $this->getFields($fieldName)->addErrorMessage('This field is required.'); return false; } if ($fieldName == 'terms' && !$value) { $this->getFields($fieldName)->addErrorMessage('You must agree with the terms and conditions to continue.'); return false; } //valid! return parent::validate($fieldName, $value); }