import { Controller } from "stimulus"
export default class extends Controller {
static targets = ["button"]
reset() {
console.log("IM IN THE RESET ACTION!!!!!");
this.element.reset();
this.buttonTarget.disabled = false;
}
}
<%= form_with model: List.new, data: {controller: 'hello', action: 'turbo:submit-end->hello#reset'} do |form| %>
<div class="field">
<%= form.label :name %>
<%= form.text_field :name %>
</div>
<div class="actions">
<%= form.submit 'Post', 'data-hello-target': 'button'%>
</div>
<% end %>