public function getErrorMessage($validator = null, $fieldName = null)
    {
        if ($this->errorMessage != "") {
            if ($fieldName != "") {
                $this->errorMessage = str_replace($this->fieldNameMask, $fieldName, $this->errorMessage);
            }
            return $this->errorMessage;
        } else {
            $validator = str_replace('{@validate:', '', $validator);
            $pos1 = strpos($validator, '(');
            $type = substr($validator, 0, $pos1);

            switch ($type) {
                case "date":
                    return MessageHelper::getMessage("VALIDATESVC_DATE_INVALID", array($fieldName));
                    break;
                case "email":
                    return MessageHelper::getMessage("VALIDATESVC_EMAIL_INVALID", array($fieldName));
                    break;
                case "phone":
                    return MessageHelper::getMessage("VALIDATESVC_PHONE_INVALID", array($fieldName));
                    break;
                case "zip":
                    return MessageHelper::getMessage("VALIDATESVC_ZIP_INVALID", array($fieldName));
                    break;
                case "social":
                    return MessageHelper::getMessage("VALIDATESVC_SOCIAL_INVALID", array($fieldName));
                    break;
                case "credit":
                    return MessageHelper::getMessage("VALIDATESVC_CREDIT_INVALID", array($fieldName));
                    break;
                case "street":
                    return MessageHelper::getMessage("VALIDATESVC_STREET_INVALID", array($fieldName));
                    break;
                case "strongPassword":
                    return MessageHelper::getMessage("VALIDATESVC_PASSWORD_NOT_STRONG", array($fieldName));
                    break;
            }
            return MessageHelper::getMessage("VALIDATESVC_INVALID", array($fieldName));
        }
    }