Rails7 Hotwire way to check username availability before form submission as the user types?

Dear Rails community,

I am quite new to Rails and came to it because the inclusion of hotwire in rails7 totally convinced me. Still, I need some help to get started:

I set up devise for user registration and authentication. On my registration form, I have a field where the user can choose a username. Next to that username field, I have a SVG icon which is supposed to show if the username is already taken or still free. I’d like it to update live as the user types.

I understand the concepts of turbo drive and turbo frames, and I guess I will need stimulus to do the debounce calls to check the username availability with the server. But unfortunately, I have no idea how to go about this.

I’d be very thankful if someone could point me in the right direction.

1 Like

Hello! The explanation is a bit long, but I recommend you to read this article where they explain how to make dynamic forms with Turbo. If you can’t understand it, let me know and I’ll look for a way to explain it.

Let me know if you can do it or if you need more help!

2 Likes

Thank you very much for your response. This is exactly what I was looking for! No further questions for now. Thank you!

1 Like