News for hackers. Stuff that matters.
Re:Build complex forms in rails with FormBuilder by jahkeup on Thursday April 03, 2014 @09:51AM (#7522753)
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).
Re:Build complex forms in rails with FormBuilder by antjanus on Thursday April 03, 2014 @11:48AM (#7523639)
Awesome. I usually don't see anyone understanding the necessity of dynamic form building.

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 :)

Re:Build complex forms in rails with FormBuilder by pothibo on Thursday April 03, 2014 @11:10AM (#7523357)
I'm glad someone understood the meaning of this article. You nailed it.