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/tree/turbo_frames_1 And the finished code is here: https://github.com/phawk/coinfusion/tree/turbo_frames_2 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-me-a-coffee-aa4618e4-45d1-4727-81b9-2d081449d61d 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!
Published: Apr 09, 2022