Hi there,
First of all, as it is my 1st post, I just want to thank you all for the great talks happening here, I already found plenty resources to learn more about Hotwire.
Because of my lack of knowledge about JS I’m not sure my issue is related to Hotwire, but it might be worth asking. Also I didn’t find any reference to this kind of Object on HTMLFormElement: submit event - Web APIs | MDN
Basically, I catch a submit-end
event to close a modal as so:
export default class extends Controller {
connect() {
this.element.addEventListener('turbo:submit-end', (event) => {
if (event.detail.success) {
this.hide_modal()
}
})
}
}
But event.detail.success
is always true
, even if model validations fail.
Is there a way to interact on the value of event.detail.success
from a Rails controller ?
Or maybe should it be done within a dedicated Stimulus controller ?
More importantly, where can I find a document on this specific Object ?