Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do i use tom-select with stimulus and hotwire?

Ahmad hamza asked in Rails

I'm using tom-select to either select from the options or create record in the modal. The problem happens when the form submits successfully and that newly created record is now have been selected in the dropdown.

Hotwire easily handles the stuff of showing validation errors on the modal but i'm not sure how to update the dropdown options using stimulus js.

Reply

I think i got the solution. I'll share a gist in sometime.

Reply

I have pushed my implementation here - https://github.com/ahmad19/tomselect-stimulus-hotwire-demo

Reply

Thanks Ahmad! This helped me out a lot.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,256+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.