Comment on Auto-saving Rails forms with Turbo StreamsComments−Kerrick1yForgive me if I'm wrong, but I think you can avoid the extra `<div>` element and `formTarget`. You can use `this.element` to do so [0]. import { Controller } from "@hotwired/stimulus"; export default class extends Controller { submit(event) { event.preventDefault(); this.element.requestSubmit(); } } and <%= form_with(model: post, url: post_path(post), data: { "controller": "autosave" }) do |form| %> <%= form.label :title %> <%= form.text_field :title, class: "input", data: { action: "blur->autosave#submit" } %> <turbo-frame id="title-status"> </turbo-frame> <% end %> [0]: https://stimulus.hotwired.dev/reference/controllers#properti...
Comments
Forgive me if I'm wrong, but I think you can avoid the extra `<div>` element and `formTarget`. You can use `this.element` to do so [0].
and [0]: https://stimulus.hotwired.dev/reference/controllers#properti...