|
|
|
|
|
by jahkeup
4466 days ago
|
|
I think there are many benefits in decoupling this form presentation logic vs plain view further with form builder compared to some gems. The ability to work with the form, create your own fields, and use presentation logic outside of the form view is great. And now knowing it's built in to rails, this is fantastic (and it's also good to know I don't always have to go to other form builder gems for their conciseness when I want that and control). |
|
In this case, you could easily get a form declaration from a database or another file, go through your controller (or form builder class) to translate it and add the correct parameters.
For those that don't get why you'd need to do that, here are some examples:
* creating forms in multiple languages (the form controller can take care of content/labeling/placeholders) * creating forms to comply in multiple countries (for example, the same sign up form in Europe may require a "accept cookies when I'm on site" checkbox or something similar). * creating forms based on preselected options. For instance, if a user is signing up for a free account, they won't need to give their name. While a paid account (by necessity of billing) will require credit card info.
Really cool :)