Skip to content

Commit

Permalink
Form // Form::isValid() should return "false", when errors are assign…
Browse files Browse the repository at this point in the history
…ed directly to the Form-element instead of the Elements within.
  • Loading branch information
Chrico committed Jun 28, 2023
1 parent 64bc402 commit 699c974
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Element/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
class Form extends CollectionElement implements FormInterface
{

protected array $attributes = [
'method' => 'POST',
];
Expand Down Expand Up @@ -123,7 +122,9 @@ public function isValid(): bool
);
}

return $this->isValid;
// Either on "submit" we have erroneous Elements, or the
// Form itself has errors assigned through Form::withErrors().
return $this->hasErrors() || $this->isValid;
}

/**
Expand Down

0 comments on commit 699c974

Please sign in to comment.