diff --git a/src/FormBuilder.php b/src/FormBuilder.php index 5ad8523..5f558cc 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -239,7 +239,7 @@ private function getInputAttributes(): array $id = $this->getId(); if (!$disableValidation && $this->errors()->count() > 0) { - $class .= $this->errors()->has($name) ? ' is-invalid' : ' is-valid'; + $class .= $this->errors()->has(\rtrim(\str_replace(['][', '[', ']'], '.', $name), '.')) ? ' is-invalid' : ' is-valid'; } $attributes = [ @@ -367,11 +367,11 @@ private function getInputErrorMarkup(string $name): string return ''; } - $error = $this->errors()->first($name); + $error = $this->errors()->has(\rtrim(\str_replace(['][', '[', ']'], '.', $name), '.')); if (!$error) { return ''; } - return '
' . $this->errors()->first($name) . '
'; + return '
' . $this->errors()->first(\rtrim(\str_replace(['][', '[', ']'], '.', $name), '.')) . '
'; } private function getId()