Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need a Rails Guide on Dynamic Forms with Hotwire #51668

Closed
nhorton opened this issue Apr 26, 2024 · 1 comment
Closed

Need a Rails Guide on Dynamic Forms with Hotwire #51668

nhorton opened this issue Apr 26, 2024 · 1 comment
Labels

Comments

@nhorton
Copy link
Contributor

nhorton commented Apr 26, 2024

This is for the doc effort.

One of the things I see questions on the most in things like Reddit forums and conversations with engineers who have been doing React a lot is how to do dynamic forms in Rails. In this context, I mean dynamic to mean things like having the choice of one field alter the other fields available or their options.

My company went through 3 iterations to get to a pattern we really like on this wherein we have a refresh_form action that re-renders our form partial for both New and Edit forms, with a stimulus controller that we attach to any field we want to trigger such a dynamic changing of the form. However, herein lies the real point: we had to set a standard for this ourselves, and there is no Rails Way for it that is documented.

This is a massively common use case, and having a Rails Guide for it that started to establish a Rails Way would be great. I suspect we would see some more pre-canned functionality to simplify this use case, but just the docs would be massively productive.

@hmzasif
Copy link

hmzasif commented Apr 29, 2024

True, having a Rails Guide dedicated to dynamic forms would undoubtedly benefit the community by providing a clear path and best practices for tackling this common use case, and it's evident that there's a demand for it.

@rails rails locked and limited conversation to collaborators Apr 30, 2024
@rafaelfranca rafaelfranca converted this issue into discussion #51697 Apr 30, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants