4 likes
·
5.0K reads
2 comments
·Feb 13, 2024
Feb 13, 2024
Hey there, Avi; thank you for sharing this post!
I was trying it on my machine, and as it turns out, we don't even need to create a custom stimulus controller.
All you need to do is set the form's data-turbo-frame="jobs" attribute and, instead of using the TurboVisit + FormData combo, call the form's requestSubmit() function.
<form data-turbo-frame="jobs" etc>
<%= select_tag :category, etc, onchange: "this.form.requestSubmit()" %>
</form>
More info:
Let me know what you think, cheers!
1
·
·1 reply
Author
·Feb 13, 2024
Ya, you could bind the onchange event to each form field to then use requestSubmit or just wrap it all in a Stimulus controller. Thanks for adding to the article! <3
·