We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 500b8d9 commit 0d88340Copy full SHA for 0d88340
lib/ruby_ui/form/form_field_controller.js
@@ -5,10 +5,12 @@ export default class extends Controller {
5
static values = { shouldValidate: false };
6
7
connect() {
8
- if (this.errorTarget.textContent) {
9
- this.shouldValidateValue = true;
10
- } else {
11
- this.errorTarget.classList.add("hidden");
+ if (this.hasErrorTarget) {
+ if (this.errorTarget.textContent) {
+ this.shouldValidateValue = true;
+ } else {
12
+ this.errorTarget.classList.add("hidden");
13
+ }
14
}
15
16
0 commit comments