Triggering Turbo Frame with JS

Ok, I couldn’t underand, why all the replies were so positive, as “nothing” didn’t work in my stimulus controller, after I upgraded turbo (previously I just “clicked” the submit button, what worked … until now).

But I’m really glad, that I read until the end of the topic, as those two solutions (actually it’s the same) are the only ones, which work for my controller, where I want to submit and register to the turbo:submit-end event:

from @defsdoor
Turbo.navigator.submitForm(this.formTarget)

and

import { navigator } from "@hotwired/turbo"
...
navigator.submitForm(this.element.closest("form"))

from @mrhead

much thanks to you both!

As it seems to be a bit of a hidden api, I hope that will least :wink:

1 Like