public function isValid() {
        $valid = TRUE;
        foreach ($this->fields as $key => $field) {

            // required
            if ($field->getOption("required") && $field->getValue() == "") {
                $this->errors[$key] = "Requerido";
                $valid = FALSE;
            }

            // custom validators
            if (isset($this->validators[$key])) {

                foreach ($this->validators[$key] as $validator) {

                    $validator->validate($field);
                    if (!$validator->isValid()) {
                        $this->errors[$key] = $validator->getMessage();
                        $valid = FALSE;
                    }
                }
            }
        }
        return $valid;
    }