Skip to content

Commit 0d88340

Browse files
authored
fix form field error (#220)
1 parent 500b8d9 commit 0d88340

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/ruby_ui/form/form_field_controller.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ export default class extends Controller {
55
static values = { shouldValidate: false };
66

77
connect() {
8-
if (this.errorTarget.textContent) {
9-
this.shouldValidateValue = true;
10-
} else {
11-
this.errorTarget.classList.add("hidden");
8+
if (this.hasErrorTarget) {
9+
if (this.errorTarget.textContent) {
10+
this.shouldValidateValue = true;
11+
} else {
12+
this.errorTarget.classList.add("hidden");
13+
}
1214
}
1315
}
1416

0 commit comments

Comments
 (0)