by strzibny on 1/9/25, 1:29 PM with 3 comments
by Kerrick on 1/9/25, 4:45 PM
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...by xutopia on 1/9/25, 4:51 PM