namespace Combodo\iTop\Form\Field; use \Combodo\iTop\Form\Field\Field; /** * Description of TextField * * @author Guillaume Lajarige */ abstract class TextField extends Field { /** * Checks the validators to see if the field's current value is valid. * Then sets $bValid and $aErrorMessages. * * @return boolean */ public function Validate() { $this->SetValid(true); $this->EmptyErrorMessages(); foreach ($this->GetValidators() as $oValidator) { if (!preg_match($oValidator->GetRegExp(true), $this->GetCurrentValue())) { $this->SetValid(false); $this->AddErrorMessage($oValidator->GetErrorMessage()); } } return $this->GetValid(); } }