Dynamic forms in Hotwire

Опубликовано: 29 Март 2026
на канале: Rapid Ruby
7,995
173

In this video, I'll show you a neat trick to swap out form fields dynamically using Turbo Frames and a tiny bit of stimulus JS (only ~5 lines). This is something I've used on a few production projects and comes in handy on your Hotwire Rails apps.

You can follow along with the source code before this tutorial:
https://github.com/phawk/coinfusion/t...

And the finished code is here:
https://github.com/phawk/coinfusion/t...

Chapters
00:00 Intro
00:17 Example Scenario
01:23 Setting Up Fields
02:30 Turboframe Wrapper
03:50 Adding Navigation Controller
05:12 Controller Params
06:34 Testing Toggle Function
07:37 Conclusion

If you like this content, please consider subscribing to the channel.

---

Has this video helped you out? Consider buying me a coffee to say thanks and support future content like this, thanks!
https://app.payhere.co/rapid-ruby/buy...

You can also find more content like this, including premium courses and exclusive community and mentorship to help you level-up! Head over to https://rapidruby.com and use the code RRYOUTUBE for a discount!