diff --git a/app/javascript/controllers/form_controller.js b/app/javascript/controllers/form_controller.js index d675dcae5..f917bd092 100644 --- a/app/javascript/controllers/form_controller.js +++ b/app/javascript/controllers/form_controller.js @@ -25,7 +25,7 @@ export default class extends Controller { if (isEmpty) { event.preventDefault() - input.setCustomValidity(input.validationMessage || "Please fill out this field") + input.setCustomValidity(input.dataset.validationMessage || "Please fill out this field") input.reportValidity() input.addEventListener("input", () => input.setCustomValidity(""), { once: true }) } diff --git a/app/views/boards/new.html.erb b/app/views/boards/new.html.erb index da74845d6..748028b8d 100644 --- a/app/views/boards/new.html.erb +++ b/app/views/boards/new.html.erb @@ -3,7 +3,7 @@
<%= form_with model: @board, class: "flex flex-column gap", data: { controller: "form", action: "submit->form#preventEmptySubmit" } do |form| %>

<%= @page_title %>

- <%= form.text_field :name, required: true, class: "input full-width", autofocus: true, autocomplete: "off", placeholder: "Name it…", data: { form_target: "input", action: "keydown.esc@document->form#cancel" } %> + <%= form.text_field :name, required: true, class: "input full-width", autofocus: true, autocomplete: "off", placeholder: "Name it…", data: { form_target: "input", action: "keydown.esc@document->form#cancel", validation_message: "Board names can‘t be blank" } %>