# Learning how to use custom Form Builders

**URL:** <https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580>\
**Category:** Rails\
**Created:** [July 27, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580 "2007-07-27T19:27:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [July 27, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580/1 "2007-07-27T19:27:25Z")

</div>

I worked my way through the FormBuilder example in the Agile Web  
Development With Rails book, but I now have some questions about  
applying this idea to other situations.

The example seems to work well for the case where I am using form\_for  
to have a single form with fields that relate to attributes of a  
particular model.

How can I use my custom FormBuilder for other situations? Examples:

1. Non-model fields added to form\_for model form.
2. Fields for other models added using fields\_for.
3. Non-model fields used for non-model forms (just using form\_tag)

It seems like the main benefit of using a custom FormBuilder is to  
enforce a consistent look across forms. It would be great to extend  
this to include all my forms, not just model-based forms.

Thanks!  
Errol

---

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [July 30, 2007, 10:57pm UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580/2 "2007-07-30T22:57:57Z")

</div>

On further inspection, it looks like I can specify a builder with  
fields\_for. That still leaves case #1 and case #3 (see above). Does  
anybody have any thoughts on this?

---

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [July 27, 2007, 7:43pm UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580/3 "2007-07-27T19:43:29Z")

</div>

maybe you are right cos django is separate model and form builder

---

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [August 1, 2007, 6:51pm UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580/4 "2007-08-01T18:51:54Z")

</div>

So, has anybody used a custom form builder?

---

<div class="post-metadata">

**Author:** ![Serengeti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e495f1/32.png) [@Serengeti](https://www.ruby-forum.com/u/Serengeti)\
**Post date:** [August 2, 2007, 2:12am UTC](https://www.ruby-forum.com/t/learning-how-to-use-custom-form-builders/110580/5 "2007-08-02T02:12:41Z")

</div>

Yes, and its been a big productivity boost once i worked out how to  
apply to html wrappers to form fields in the way i wanted. However,  
like you, i would like to use if for non-model forms and for  
fields\_for forms. I haven’t put that high enough on the priority list  
to investigate, although i did note that fields\_for is in the context  
of form\_for so I suppose there is some hope there - but I don’t know  
how to get under the covers of fields\_for.

Cheers, --Kip
