Closed andrii-pukhalevych closed 1 month ago
In cakephp 3 condition was !this.validity.valid
.
Not sure why it was changed. Maybe because another types of validation were added, like invalid email format or min/max values etc.
The behavior was changed back in https://github.com/cakephp/cakephp/pull/13499
Description
FormHelper generates the same
oninvalid
code for text inputs and checkoxes:this.setCustomValidity(''); if (!this.value) this.setCustomValidity(this.dataset.validityMessage)
In case of checkboxes,
!this.value
is always false, because it can be true only if checkbox value="". Condition should be!this.checked
instead - this will allow to show custom error message for unchecked required checkbox.CakePHP Version
4.5.4, 5.0
PHP Version
No response