Files
openfoodnetwork/app/webpacker/controllers/form_controller.js
David Cook 05f0b93548 Use requestSubmit to allow JS events
Yay, now it works. Not sure the best way to show loading yet.
- currently the Turbo loading indicator shows which is better than nothing (blue bar at top)
- ideally we could show a small spinner over the image thumbnail. need to write some stimulus to hook into turbo lifecycle I guess.
- or we could activate the frame-level loading overlay. refactor loading_controller a bit so that it's applied on the container, then hopefully  we can just call  change->loading#showLoading. the turbo_stream response could dectivate it.
2024-05-23 11:55:33 +10:00

10 lines
329 B
JavaScript

import { Controller } from "stimulus";
export default class FormController extends Controller {
submit() {
// Validate and submit the form, using the default submit button. Raises JS events.
// Ref: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit
this.element.requestSubmit();
}
}