Skip to content

Commit cd5ff7e

Browse files
committed
Use standard submit event instead of turbo:submit for validation
The turbo:submit event may not fire correctly with SWC-compiled code. Using the standard DOM submit event should work more reliably.
1 parent 474e8ee commit cd5ff7e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/views/comments/turbo/_horizontal_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<hr />
66

7-
<%= form_with(model: @comment, data: { action: "turbo:submit->comments#resetText" }, class: "form-horizontal flex flex-col gap-4") do |f| %>
7+
<%= form_with(model: @comment, data: { action: "submit->comments#resetText" }, class: "form-horizontal flex flex-col gap-4") do |f| %>
88
<div class="form-group flex flex-col gap-0 items-center lg:gap-4 lg:flex-row">
99
<%= f.label "Name", class: "w-full lg:w-2/12 lg:text-end shrink-0" %>
1010
<%= f.text_field :author, data: { comments_target: "commentAuthor" }, class: "px-3 py-1 leading-4 border border-gray-300 rounded w-full", placeholder: "Your Name" %>

app/views/comments/turbo/_inline_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<hr />
66

7-
<%= form_with(model: @comment, data: { action: "turbo:submit->comments#resetText" }, class: "form-inline flex flex-col lg:flex-row flex-wrap gap-4") do |f| %>
7+
<%= form_with(model: @comment, data: { action: "submit->comments#resetText" }, class: "form-inline flex flex-col lg:flex-row flex-wrap gap-4") do |f| %>
88
<div class="flex gap-2 items-center">
99
<%= f.label "Name", class: "form-label mr-15" %>
1010
<%= f.text_field :author, data: { comments_target: "commentAuthor" }, class: "px-3 py-1 leading-4 border border-gray-300 rounded", placeholder: "Your Name" %>

app/views/comments/turbo/_stacked_form.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<hr />
66

7-
<%= form_with(model: @comment, data: { action: "turbo:submit->comments#resetText" }, class: "flex flex-col gap-4") do |f| %>
7+
<%= form_with(model: @comment, data: { action: "submit->comments#resetText" }, class: "flex flex-col gap-4") do |f| %>
88
<div class="flex flex-col gap-0">
99
<%= f.label "Name", class: "w-full" %>
1010
<%= f.text_field :author, data: { comments_target: "commentAuthor" }, class: "px-3 py-1 leading-4 border border-gray-300 rounded w-full", placeholder: "Your Name" %>

0 commit comments

Comments
 (0)