My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Avi Flombaum

4 likes

·

4.9K reads

2 comments

Matias H. Leidemer
Matias H. Leidemer
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
Avi Flombaum
Avi Flombaum
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

·