Replies: 2 comments
-
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. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't know if 37Signals has many of these forms and has a pattern already. My company (Unsupervised.com) created one that has generally worked well, but I suspect DHH and others would suggest changes. I am happy to record and link a video of our approach if it is helpful for this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions